I have log messages coming in and a few of them have one of three special characters: @, -, or #.
How can I get grok to ignore the hashtag without removing it from the new field? Below is the code snippet I'm using.
It works fine when it's just this:
(?<Tran_ID>[0-9A-Z@]{3,4})
But when I add the hasthtag, the rest becomes a comment:
(?<Tran_ID>[0-9A-Z@#- ]{3,4})
Badger
September 8, 2023, 4:46pm
2
Can you provide more detail? If I run
input { generator { count => 1 lines => [ '{ "id": "The id is A1#9" }' ] codec => json } }
output { stdout { codec => rubydebug { metadata => false } } }
filter { grok { match => { "id" => "(?<Tran_ID>[0-9A-Z@#-]{3,4})" } } }
then I get "Tran_ID" => "A1#9"
.
1 Like
system
(system)
Closed
October 6, 2023, 4:47pm
3
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.