I'm trying to apply a state (with a field in ES) to subsequent log lines after seeing
[message] =~ "foo" but have not had luck using class variables with the ruby filter (
@@classVariable) as described in Keeping global variables in LS?! with logstash 6.0.1.
I find that the class variable does not hold the correct value when exploring the data on discover in Kibana. Specifically, I want the state to change when I see
[message] =~ "bar" and then hold that value until
[message] =~ "foo" is seen, however I notice that the state will change value when it should not have. I'm using a different named capture from grok (that I also store in ES) to set the state when it is present, and when the state changes that named capture isn't even present, so something else is changing this class variable.
It's been two years since that post, and this doesn't seem like an unreasonable thing for someone to do, so I'm hoping there's another method now that I haven't found?