Rsyslog regex extract trigrams from hostname

136 Views Asked by At

I have difficulties to find a way to extract a trigram from the %hostname% var in rsyslog conf to create a path with POSIX regex.

My logic was to take the 3 characters before the first digit of the hostname.

Any ideas to have this result from only one regex ? I tried to find solutions on forum/website but none works for my case. i know that positioning lookbehind and lookforward does not work with POSIX

Hope you can help me with this one.

thx !

exemple: zyabc01da and need to keep the abc trigrams to make something like this /LOGS/abc/hostname/*.logs

i tried regex like this one (.{3}[\d]) or (.{3}[\D]), but i can't get rid of the first digit and the only solution i have is to make a second regex ([\D]+)

0

There are 0 best solutions below