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

Negative numbers not extracted by promtail to a Gauge metric #3281

Closed
xkilian opened this issue Feb 2, 2021 · 3 comments · Fixed by #3971
Closed

Negative numbers not extracted by promtail to a Gauge metric #3281

xkilian opened this issue Feb 2, 2021 · 3 comments · Fixed by #3971
Assignees
Labels
keepalive An issue or PR that will be kept alive and never marked as stale.

Comments

@xkilian
Copy link

xkilian commented Feb 2, 2021

Describe the bug
Negative numbers cannot be extracted as Gauge metrics from logs in promtail.

To Reproduce
promtail config:

     #<13>Jan 28 14:25:52 vehicule=1 longitude=-10.1234 latitude=15.1234
      - match:
          selector: '{host="whatever"}'
          stages:
            - regex:
                expression: 'vehicule=(?P<vehicule>\d+) longitude=(?P<longitude>[-]?\d+\.\d+) latitude=(?P<latitude>\d+\.\d+)'
            - labels:
                vehicule:
            - metrics:
                longitude:
                  type: Gauge
                  description: "longitude GPS vehicule"
                  config:
                    match_all: true
                    action: set
                latitude:
                  type: Gauge
                  description: "latitude GPS vehicule"
                  config:
                    match_all: true
                    action: set

Expected behavior
Numbers like -10.1234 should be extracted from log lines.

Environment:

  • linux Ubuntu 64bit
  • loki 2.1

Screenshots, Promtail config, or terminal output
logfmt in logql has not problem with negative numbers, but promtail cannot cast the extracted number as a signed float to a Gauge after regex extraction.

@stale
Copy link

stale bot commented Mar 19, 2021

This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale A stale issue or PR that will automatically be closed. label Mar 19, 2021
@cyriltovena cyriltovena self-assigned this May 18, 2021
@stale stale bot removed the stale A stale issue or PR that will automatically be closed. label May 18, 2021
@stale
Copy link

stale bot commented Jun 18, 2021

This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale A stale issue or PR that will automatically be closed. label Jun 18, 2021
@xkilian
Copy link
Author

xkilian commented Jun 18, 2021

This is still a problem for anyone dealing with extractions of GPS numbers, DBm, DB or any other signal type data.

@stale stale bot removed the stale A stale issue or PR that will automatically be closed. label Jun 18, 2021
@owen-d owen-d added the keepalive An issue or PR that will be kept alive and never marked as stale. label Jul 8, 2021
cyriltovena added a commit to cyriltovena/loki that referenced this issue Jul 8, 2021
Fixes grafana#3281

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
cyriltovena added a commit that referenced this issue Jul 8, 2021
* Fixes negative gauge in Promtail.

Fixes #3281

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* got linted.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keepalive An issue or PR that will be kept alive and never marked as stale.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants