Already programmed patterns in regular expressions in logstash

(Darya Semenova) #1

Hello, I'd like to know if it is possible to insert patterns that were previously written in new regular expressions.

For example, will the code like that be possible when implementing my own patterns?

EXPBEGIN (([A-Za-z0-9]{0,20})(\-)?([A-Za-z0-9]{0,20})(\.[A-Za-z0-9]{0,20})?(\,)*([A-Za-z0-9]{0,20}(\-?[A-Za-z0-9]{0,20})*)(\.[A-Za-z0-9]{0,20})?)+
EXP_1 ([a-z]{5,5})\s\-([A-Za-z])\s([a-z]{4,4})\s\-([A-Za-z])\s(?:%{EXPBEGIN})
EXP_2 (\-([A-Za-z]\s(?:%{EXPBEGIN})\s[a-z]{5,5})\s\-([A-Za-z])\s([a-z]{4,4}))


Normally it is.

I've already done something similar:
F_TIMESTAMP %{YEAR:year}%{MONTHNUM:month}%{MONTHDAY:monthday}\s*%{TIME:time}\s*%{ISO8601_TIMEZONE:timezone}

(reusing already-defined patterns)
And if you check this:
for any pattern, you'll see that you can reuse previously defined patterns (and imho, it's recommended)

(Darya Semenova) #3

Ok, thank you very much!

(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.