Resolve Rsyslog Log Distribution filtering issues

Source: Internet
Author: User
Tags rsyslog

Problem Description:

Server B receives message gateway logs from Server A from the remote side, and according to the configuration requirements, these logs need to be written in different files according to the message label classification.

For example, there is a log:

Sep 08:00:03 192.100.6.3 monster-cmpp20mo[37518]: 20180912080002sms0000999l00100000000cc515275,0,00,,, 09120800018510260295,,,, xxxxxxxxxxx,,, 1,xxxxxxxxxx,,,,,,,,,,,, 0,6,dm302j,

We want to be able to write to the Monster-cmppmo.log file as a message label such as "Monster-cmpp20mo".

However, the effect of log filtering cannot be achieved by the previous configuration, and Server B writes all the logs it receives to each file. There is no sorting process at all.

Workaround:

Add a template First

" %timegenerated%%hostname%%syslogtag%%msg:::d rop-last-lf%\n " PS: drop-last-lf means write all logs

Once you have finished adding templates, you need to configure the template to use it.

if ' monster-cmpp20mt '  then {*.=info  /xxx/xxx/monster-cmppmt.log; Traditionalformat}if'monster-mm7mt')then  {*.=info  /xxx/xxx/monster-mm7mt.log; Traditionalformat} ...

Restart Rsyslog to resolve.

Resolve Rsyslog Log Distribution filtering issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.