Skip to content

No metrics | labels #409

Open
Open
@jfiesy

Description

@jfiesy

Hi!
getting scrap from log:

10.0.20.142 - - [19/Feb/2025:17:04:37 +0300] "GET /archive/externalFiles/%D0%9A%D0%9D/830/npacl_1.png HTTP/2.0" 302 145 "https://kms167-mod.data-integration.ru/kms/CM/T_PROCEDURE/UPDATE?item_id=149&isInfo=yes&include_itm_keywords=Y&item_max_version=Y&item_revision=4" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36" "-" "-"
10.0.20.142 - - [19/Feb/2025:17:04:37 +0300] "GET /archive/externalFiles/%D0%9A%D0%9D/830/npacl_2.png HTTP/2.0" 302 145 "https://kms167-mod.data-integration.ru/kms/CM/T_PROCEDURE/UPDATE?item_id=149&isInfo=yes&include_itm_keywords=Y&item_max_version=Y&item_revision=4" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36" "-" "-"

by config example-config.hcl:

listen {
port = 4040
metrics_endpoint = "/metrics"
address = "0.0.0.0"
}
consul {
enable = false
}
namespace "nginx" {
format = "$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for" "$cookie_JSESSIONID""

source {
files = [
"/var/log/nginx/access.log"
]
}

labels {
service = "nginx-final"
hostname = "lb1"
}

log can be printed to std out, e.g. for debugging purposes (disabled by default)

print_log = false

histogram_buckets = [.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10]
}

And run command:
./prometheus-nginxlog-exporter --config-file=example-config.hcl

Image

But, when getting mertics there is no labels and rets metrics:

Image

Where is error ?

I also have tryed to add params to labels like that:
labels {
service = "nginx-final",
hostname = "lb1",
labelnew = $request
}

but its dont whant work at all (

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions