Decorated actions and log line consumption

Skip to first unread message

Joshua Chia

Nov 18, 2021, 4:36:19 AM11/18/21
to mtail-users
The Language Reference has an example decorator called syslog. It is used to extract the timestamp string from the beginning of each log line.

So, conceptually syslog takes care of the timestamp at the start of the line and other patterns take care of the rest of the line, good for separation of concerns, readability, performance and what not.

Except I found that there is actually no "separation of concern". In the action being decorated, it is still possible to match the timestamp string at the start of the line that was already matched by the syslog decorator. For separation of concern, I would like the patterns inside the decorated action to see the line as starting after whatever was matched by syslog. 'next' does not do this. Is it possible to make the patterns inside the decorated pattern see only the part of the line after whatever was matched by the decorator?

In essence, I would like something like 'next' that presents to the decorated actions a suffix of the original line that starts right after whatever is matched by the decorator.


Jamie Wilkinson

Nov 25, 2021, 7:27:23 PM11/25/21
to Joshua Chia, mtail-users
If I remember correctly, the $message variable is set by that decorator.  You're right that there's no separation of concerns, and I remember thinking about implementing what you suggest and I cannot remember why I didn't do that.  So, the whole log line is still available to the implicit match, but you can do an explicit match with, e.g.:

 $message ~= /asdfasdf/ {

Seems like a reasonable request to be able to define a greedy decorator that replaces the implicit match with the remaining text if it likes, though.

You received this message because you are subscribed to the Google Groups "mtail-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

☂Josh Chia (謝任中)

Nov 26, 2021, 12:50:46 AM11/26/21
to Jamie Wilkinson, mtail-users
I see. I can explicitly capture the rest of the line and later match against it. Thanks.

Jamie Wilkinson

Nov 26, 2021, 1:22:07 AM11/26/21
to ☂Josh Chia (謝任中), mtail-users
I'd appreciate a feature request filed though!

☂Josh Chia (謝任中)

Nov 30, 2021, 6:54:06 AM11/30/21
to Jamie Wilkinson, mtail-users
Reply all
Reply to author
0 new messages