EVENT is stored in action. I want to store NEW EVENT in action. I can't seem to figure out how to store this. There does not seem to be any regex that allows for this. Is there a syntax that I am missing that can do this?
if [action1] and [action2]{
mutate{
add_field => {"action" => "%{action1} %{action2}"}
}
}
Ideally I wouldn't want to have that second chunk of code or store action1 and action2. So if anyone has a solution where I can change my grok that'd be appreciated
Thanks @magnusbaeck that worked. Can you help me understand it so that I can write groks better in the future. I understand that the \w is a word character. But the plus in front of the action is confusing for me.
Oops. I meant the ? in front of the action. I think I understand the \w+ \w+. From what I understand of regexes the ? means match one or more of previous token. But when it is inside of the () I am unsure if that means the action field is optional or not?
? means "zero or one occurrence of the preceding token". Parentheses can be used to group tokens, i.e. it changes the maning of "preceding token". With abc? it's just the "c" that's optional but with (abc)? it's the whole phrase "abc" that's optional.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.