fluent-plugin-grok-parser icon indicating copy to clipboard operation
fluent-plugin-grok-parser copied to clipboard

Syslog TAGs exceeding 32 character will not grok

Open afammartino-godaddy opened this issue 2 years ago • 0 comments

Hello Everyone! I would like some feedback on an issue i've observed with syslog tags exceeding 32 characters. The syslog RFC defines a "TAG" in the syslog message (typically program name and pid) must not exceed 32 characters. Rsyslog will truncate any part of the TAG past 32 characters when shipping logs (at least on my systems Cent/Alma). Resulting in something like this:

original message:
<77>Aug 18 05:00:03 my-test-host run-parts(/etc/cron.daily)[25833]: finished prelink

what fluentd sees:
<77>Aug 18 05:00:03 my-test-host run-parts(/etc/cron.daily)[25833 finished prelink

You'll notice that run-parts(/etc/cron.daily)[25833 is exactly 32 characters. I suggest a change to SYSLOGBASE that accounts for this in case rsyslog or any other shipping mechanism enforces the rfc standard. Something along the lines of:

SYSLOG_LONGTAG [\x21-\x5a\x5c\x5e-\x7e\x5b\x5d]{32}
SYSLOGPROG (%{PROG:[process][name]}(?:\[%{POSINT:[process][pid]:integer}\])?|%{SYSLOG_LONGTAG:syslog_longtag})

Thoughts? Kudos to @tlaberge-godaddy for finding this.

afammartino-godaddy avatar Aug 19 '22 01:08 afammartino-godaddy