Linux/보안장비 운용

로그 관리 프로그램 logrotate

GGkeeper 2022. 3. 4. 22:04

###############
## logrotate ##
###############
로그 관리 프로그램

/var/lib/rpm : 패키지 설치 rpm DB

rpm -q 패키지명
rpm -qa | grep 패키지명
rpm -qi 패키지명
rpm -ql 패키지명
rpm -qf 파일명

# rpm -q logrotate
logrotate-3.8.6-19.el7.x86_64

# rpm -ql logrotate
/etc/cron.daily/logrotate
/etc/logrotate.conf
/etc/logrotate.d
/etc/rwtab.d/logrotate
/usr/sbin/logrotate
/usr/share/doc/logrotate-3.8.6
/usr/share/doc/logrotate-3.8.6/CHANGES
/usr/share/doc/logrotate-3.8.6/COPYING
/usr/share/man/man5/logrotate.conf.5.gz
/usr/share/man/man8/logrotate.8.gz
/var/lib/logrotate
/var/lib/logrotate/logrotate.status

# rpm -qi logrotate
Name        : logrotate
Version     : 3.8.6
Release     : 19.el7
Architecture: x86_64
Install Date: 2022년 03월 04일 (금) 오전 09시 31분 29초
Group       : System Environment/Base
Size        : 107068
License     : GPL+
Signature   : RSA/SHA256, 2020년 04월 04일 (토) 오전 06시 01분 10초, Key ID 24c6a8a7f4a80eb5
Source RPM  : logrotate-3.8.6-19.el7.src.rpm
Build Date  : 2020년 04월 01일 (수) 오후 12시 26분 19초
Build Host  : x86-02.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : https://github.com/logrotate/logrotate
Summary     : Rotates, compresses, removes and mails system log files
Description :
The logrotate utility is designed to simplify the administration of
log files on a system which generates a lot of log files.  Logrotate
allows for the automatic rotation compression, removal and mailing of
log files.  Logrotate can be set to handle a log file daily, weekly,
monthly or when the log file gets to a certain size.  Normally,
logrotate runs as a daily cron job.

Install the logrotate package if you need a utility to deal with the
log files on your system.

# cat /etc/logrotate.conf 
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
dateext

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
minsize 1M
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}

# system-specific logs may be also be configured here.


# ls /etc/logrotate.d/
bootlog  chrony  firewalld  syslog  wpa_supplicant  yum

# cat /etc/logrotate.d/syslog 
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
{
    missingok
    sharedscripts
    postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}

'Linux > 보안장비 운용' 카테고리의 다른 글

logger 사용하기  (0) 2022.03.04
logrotate 실행하기  (0) 2022.03.04
원격 로그 서버 구축하기  (0) 2022.03.04
장치에 로그 출력하기  (0) 2022.03.04
/etc/rsyslog.conf  (0) 2022.03.04