1

For a PromTail scrape config, I am using a JSON stage.

I have a JSON log that looks like this:

{
   "@l": "info",
   "foo": "bar"
}

I am looking to use the JSON stage to extract the @l property into the map.

I tried this:

- json:
     expressions:
       level: '"@l"'
- labels:
     level:

The agent starts but no logs are scraped. If I remove the JSON stage, tons of logs come in.

What could I be doing wrong with the @ escape sequence?

β.εηοιτ.βε
  • 33,893
  • 13
  • 69
  • 83
Gabe
  • 49,577
  • 28
  • 142
  • 181

1 Answers1

1

I have confirmed. To escape a @ or ., you use double quotes.

so examples:

{
   "@l": "Debug",
   "foo.bar": "value"
}

'"@l"'

or

'"foo.bar"'

Source

Using a JMESPath Literal

This pipeline uses a literal JMESPath expression to parse JSON fields with special characters in the name, like @ or .

Gabe
  • 49,577
  • 28
  • 142
  • 181