IT용어위키



리눅스 rsyslog.conf

리눅스에서 각종 시스템로그를 관장하는 rsyslog의 설정파일
  • 위치 : /etc/rsyslog.conf
  • 초기 파일 내용
# rsyslog v5 configuration file
# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html

#### MODULES ####
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imklog   # provides kernel logging support (previously done by rklogd)
#$ModLoad immark  # provides --MARK-- message capability

#### GLOBAL DIRECTIVES ####
# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# File syncing capability is disabled by default. This feature is usually not required,
# not useful and an extreme performance hit
#$ActionFileEnableSync on

# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf

#### RULES ####
# 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

규칙

rsyslog.conf의 rule은 facility.priority action으로 이루어져 있다.
  • facility : 로그를 출력하는 각종 서비스, 프로그램을 정의한다.
  • priority : 로그의 중요도를 구분하는 구분값이다.
    • none, debug, info, notice, warn, error, crit, alert, emerg, panic 등이 있다.
  • action : 특정 facility의 지정된 priority에 해당하는 로그가 발생했을 경우의 액션을 정의한다.
    • file : /var/log/cron 처럼 로그가 기록될 파일을 지정할 수 있다.
    • @host : @127.1.2.3 처럼 특정 외부 호스트를 지정하여 로그를 보낼 수 있다.
    • user : 특정 사용자의 터미널로 로그를 보낸다.
    • * : 현재 로그인되어 있는 모든 사용자의 터미널로 보낸다.
    • 기타 콘솔 또는 터미널로 지정할 수 있다.


  • 특정 로그를 제외시킬 수 있다
    • cron이라는 facility 제외 : cron.none
    • info라는 priority 제외 : cron.!=info


ex) mail 관련한 모든 정보는 /var/log/maillog에 기록하는데, info 수준의 로그는 제외한다.

mail.*;mail.!=info /var/log/maillog

  출처: IT위키(IT위키에서 최신 문서 보기)
  * 본 페이지는 공대위키에서 미러링된 페이지입니다. 일부 오류나 표현의 누락이 있을 수 있습니다. 원본 문서는 공대위키에서 확인하세요!