Wednesday, 4 September 2013

How to setup log files in linux

Directing System Messages to Log Files (syslog)

Problem: You want to configure the system logger to use an organized collection of log files,

Solution: Setup /etc/syslog.conf for local logging

# vim /etc/syslog.conf

# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.*                                      /dev/console
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none  /var/log/messages

# The authpriv file has restricted access.
authpriv.*                             /var/log/secure

# Log all the mail messages in one place.
mail.*                                 -/var/log/maillog

# Log cron stuff
cron.*                                  /var/log/cron

# Everybody gets emergency messages
*.emerg                                      *

# Save news errors of level crit and higher in a special file.
uucp,news.crit                       /var/log/spooler

# Save boot messages also to boot.log
local7.*                               /var/log/boot.log

After you modify /etc/syslog.conf you must send a signal to force syskogd to reread it and apply your changes, Any of these will do

# kill -HUP `pidof syslogd`
# /etc/init.d/syslog reload
# service syslog reload

No comments:

Post a Comment