Skip to main content

Posts

Showing posts with the label Log

rsyslog

Installation apt-get install rsyslog The configuration file is at /etc/rsyslog.conf Basic syntax To define log format. $template <format name> , "<format string>" To filter and select destination. if <filter logic> then <destination>;<format name> For the above, it must be in one line, or with line separator "\". Example : For the properties used in the template format and in the filter, please check out the online manual : http://linux.die.net/man/5/rsyslog.conf My testing : This is the messages directed to the destination specified in the example : Some additional notes. If you are seeing the message trailing by #012, put the below into your configuration file. I do not encounter this in Ubuntu, however, I see this in Debian. $EscapeControlCharactersOnReceive off If you see your log happened to have the messages claimed to be repeated as below image : The default configuration file must have this $R...

syslog-ng on Ubuntu

Installation apt-get install syslog-ng The configuration file is at /etc/syslog-ng/syslog-ng.conf Some basic syntax To define the log to be printed out on all terminals. This normally available in the default configuration file. destination <identifier> { pipe("/dev/xconsole"); }; To define a file where log should be directed to. destination <identifier> { file("<file name in full path>"); }; To format the log, you can use template in your destination. destination <identifier> { file("<file name in full path>" template("$ISODATE:$MESSAGE")); }; If you would like to fully format the logline, you can use $MSGONLY. However, please remember to put a newline character at the end of the template. Filters can be set based on facility, priority, program name, keyword matching and etc. You can refer to this : http://www.balabit.com/sites/default/files/documents/syslog-ng-ose-3.3-guides/sys...