regexsyslog-ng

Regular expression to not match the logs with unreadable characters in syslog-ng


I am getting these kind of lines with other relevant log lines in the logs

/M��P���������
M�bM���������
�?�@���������
�S��T���������
��bM���������
E��F���������
22��O���������
��9���������
_������������

These lines are non-readable so I want to exclude these all log lines.

Sample log lines looks like

Aug 18,etc message...

So basically what I am trying to achieve is something like below:

{netmask(192.168.0.1/32) and not(match("\W+))};

Solution

  • You could exclude lines with non-ascii characters, if that's what you want.

    Could look like this (I guess):

    {netmask(192.168.0.1/32) and not(match('[\x80-\xff]'))};
    

    Note: I used single ' quotes in this example.
    If you use " double-quotes, you have to use \\ instead of \.