Hello,
Hoping to get a clarification on using _raw.match function in a data router, similar to the solution posted here: Syslog Best Practices | Cribl Docs
In the linked article, the match function is used without a regex, and doesn’t seem to require any further logic, such as: raw.match('TRAFFIC')
Is my understanding correct, that using a string match doesn’t require any additional test, but using regex does? If so, may I suggest the documentation example I linked be updated to show the use of RegEx please?
As long as the expression returns ‘true-like’ the event will match. My recommendation for this sort of test is to use the Regex.test() method instead as it uses fewer resources:
/your.*regex.*here/.test(_raw)
EDIT: To be clear _raw.match(/TRAFFIC/i) will work fine. You don’t need any comparison operators. If it doesn’t match it returns null which will equate to false. If it does match, the return value will cause the expression to return true.
Yes, I have a filter in regex extract. I then call a regex command. Will the regex command automatically extract from the filter or do I need to declare the new source field?