I've a code in grok, which captures messages, and if they meet a given criteria, they get a tag.
My problem is, that sometimes this filter works while testing, and sometimes does not. The regexp in question is the following:
^(?!(?:\d\d\d\d-\d\d-\d\d.\d\d:\d\d:\d\d)).*$
This line checks if the given message does not begin with a given time stamp format. In other words: if the given message does not begin with this time stamp, then it gets a tag.
You can test it yourself with this online application: http://grokconstructor.appspot.com/do/match#result
For these test values, the regepx captures all messages which meets the criteria, so the two lines with "test" are highlighted in green:
test
2016-09-23 18:26:49,714
2016-09-23 18:26:40,244
test
However it captures the first date when the input is something like this:
2016-09-23 18:26:49,714
2016-09-23 18:26:40,244
test
I would like to understand what is the reason behind this behaviour, and how could I prevent it?