보안 루피

리눅스마스터 1급 실기 : 로그파일 관리 본문

리눅스 마스터 1급

리눅스마스터 1급 실기 : 로그파일 관리

잔망 루피 2023. 5. 4. 15:57

/etc/logrotate.conf   : 로그 설정 파일

/etc/logrotate.d 내부에 설정할 수 있는 여러 파일이 존재

[root@localhost logrotate.d]# ls

bootlog  firewalld  iscsiuiolog    numad   samba   vsftpd
chrony   glusterfs  libvirtd       ppp     sssd    wpa_supplicant
cups     httpd      libvirtd.qemu  psacct  syslog  yum

vi  /etc/logrotate.conf   

[root@localhost logrotate.d]# vi /etc/logrotate.conf

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

[주기]

  • daily : 일
  • weekly : 주
  • monthly : 달
  • yearly : 연

[rotate]

횟수 설정

 

create  허가권  소유자  소유그룹 

로그파일명을 지정할 때

create 0664 root utmp

 

minisize 1M  :  1M 가되면 로테이트 실행하겠다.

missingok  : missing ok(놓쳐도 괜찮아)             로그파일 없으면 에러 메시지 출력 X

nomissingok  :  no missing  ok (놓치지않겠다)  로그파일 없으면 에러메세지 출력 O  

 

더보기

1. /etc/logrotated.conf

 

2. /var/log/wtmp

3.weely

4.missingok

 

create 0600 root utmp             파일 권한 0600 소유자 root  소유그룹 utmp

rotate 5                                       5번 로테이트