Engineering/__00. Linux
Linux Log 관리
qahuni
2024. 7. 31. 16:26
경로 /var/log
설정 /etc/rsyslog.conf
설정 변경 후 다음 명령을 수행하여 반영
어떤 이유로 로그 파일을 수동으로 다시 만든 경우에도 다음 명령을 수행해야 반영된다.
# systemctl restart rsyslog
Logrotate 설정 /etc/logrotate.conf
# rotate log files weekly (매주 rotate 하되)
weekly
# use the adm group by default, since this is the owning group (다음 권한으로 하고)
# of /var/log/syslog.
su root adm
# keep 4 weeks worth of backlogs (52개를 유지하고)
rotate 52
# create new (empty) log files after rotating old ones (rotate 후 빈 새파일을 만들어 놓고)
create
# use date as a suffix of the rotated file (ratate 된 파일은 날짜형식으로 이름을 붙이고)
dateext
# uncomment this if you want your log files compressed (rotate 된 파일은 압축해 놓고)
compress
# packages drop log rotation information into this directory (추가 rotate 정보는 다음 폴더를 포함시켜라)
include /etc/logrotate.d
Samba Log 설정 (/etc/samba/smb.conf)
기본으로는 다음 설정만 있다
#### Debugging/Accounting ####
# This tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/log.%m
log level = 3 (추가한다.)
# Cap the size of the individual log files (in KiB).
# max log size = 1000
max log size = 10000 (기본값을 늘려준다.)
# If you want Samba to only log through syslog then set the following
# parameter to 'yes'.
# syslog only = no
# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
syslog = 0
# Do something sensible when Samba crashes: mail the admin a backtrace
panic action = /usr/share/samba/panic-action %d