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

Additional label by regex of log lines #1974

Open
orlovds opened this issue Oct 25, 2024 · 1 comment
Open

Additional label by regex of log lines #1974

orlovds opened this issue Oct 25, 2024 · 1 comment

Comments

@orlovds
Copy link

orlovds commented Oct 25, 2024

Good day,
There is a text log with the following lines:
25-Oct-2024 13:02:09.497 info: client @0x7f5ee414b5d0 10..x.y.z#59452 (grafana.it.jab): query: grafana.it.jab IN A +E(0) (10.255.30.21)

I wrote such an attempt:

loki.relabel "dns_logs" {
  forward_to = [loki.write.ext.receiver]

  rule {
    target_label = "dns_request"
    regex = "((.+?)):"
    replacement = "${1}"
  }
}

I waiting label "dns_request" with value "grafana.it.jab", but they are not there...
Can you tell me the reason?

Thank you in advance!

@Nachtfalkeaw
Copy link

Hello,

I think you need to define the proper "source_labels" or your "grafana.it.jab" is not in a label so can not be matched and regexed and replaced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants