Search code examples
regexgrafana

Fetch all the entries/word/line after a specfic word in Grafana using regex


I am new to regex and need some help in fetching all the entries after a specific word. I am working on Grafana panels and using option "Filter data by values" under edit option

Let the specific word be "sample_word" post which I want to fetch everything no matter what.

My sample string is below

700 <10> 2022-11-21T05:00:09 sample_word="abc.net"] 2022-11-21T05:00:09 | api.call | line 100 | INFO | [123456]

I tried below which but couldn't figure out the solution

/.+?(?=sample_word)/g


Solution

  • You could use a fixed width positive lookbehind here:

    (?<=\bsample_word).*
    

    This would match all content in the log line after sample_word. Here is a demo.