Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something wrong with relabel match regexp | not working in some cases #377

Open
itshikanov opened this issue Jan 31, 2024 · 0 comments
Open
Labels

Comments

@itshikanov
Copy link
Contributor

Describe the bug
hello.
relabel match not working in some cases

To Reproduce
nginx:

log_format syslog'$host\t$status\t$upstream_addr\t$request_method\t$upstream_response_time\t$request_time\t$request_length\t$body_bytes_sent\t$request';
access_log syslog:server=127.0.0.1:8887,tag=nginx syslog;

nginxlog-exporter config:

listen {
  port = 9102
}

namespace "nginx" {
  source = {
    syslog {
      listen_address = "udp://127.0.0.1:8887"
      format = "auto"
      tags = ["nginx"]
    }
  }
  format = "$host\t$status\t$upstream_addr\t$request_method\t$upstream_response_time\t$request_time\t$request_length\t$body_bytes_sent\t$request"
  relabel "host" { from = "host" }

  relabel "request_uri" {
    from = "request"
    split = 2
#    separator = " "

    match "^(.*)$" {
      replacement = "$1"
    }
  }

}

got metrics like this

nginx_http_upstream_time_seconds_hist_bucket{host="test.local",request_uri="",status="200",le="+Inf"} 587

problem:

request_uri=""

But when i add ',' or '\t' character at the end of log_format all work fine.
example
nginx:

log_format syslog'$host\t$status\t$upstream_addr\t$request_method\t$upstream_response_time\t$request_time\t$request_length\t$body_bytes_sent\t$request,';

nginxlog:

  format = "$host\t$status\t$upstream_addr\t$request_method\t$upstream_response_time\t$request_time\t$request_length\t$body_bytes_sent\t$request,"

result:

nginx_http_upstream_time_seconds_hist_count{host="test.local",request_uri="/v1/test/wesqwex?a=1",status="200"} 424
@itshikanov itshikanov added the bug label Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant