|
@@ -0,0 +1,55 @@
|
|
|
|
+[root@localhost ~]# vim /etc/logrotate.conf
|
|
|
|
+[root@localhost ~]# cd /etc/logrotate.d
|
|
|
|
+[root@localhost logrotate.d]# ls
|
|
|
|
+bootlog chrony firewalld syslog wpa_supplicant yum
|
|
|
|
+[root@localhost logrotate.d]# vim chrony
|
|
|
|
+[root@localhost logrotate.d]# vim xunwang
|
|
|
|
+/usr/local/src/nohup.out {
|
|
|
|
+ daily
|
|
|
|
+ rotate 15
|
|
|
|
+ sharedscripts
|
|
|
|
+ postrotate
|
|
|
|
+ /bin/kill -HUP $(/bin/cat /var/run/syslogd.pid) &>/dev/null
|
|
|
|
+ endscript
|
|
|
|
+}
|
|
|
|
+[root@localhost logrotate.d]# logrotate -vf /etc/logrotate.conf
|
|
|
|
+rotating pattern: /usr/local/src/nohup.out forced from command line (15 rotations)
|
|
|
|
+empty log files are rotated, old logs are removed
|
|
|
|
+considering log /usr/local/src/nohup.out
|
|
|
|
+ log needs rotating
|
|
|
|
+rotating log /usr/local/src/nohup.out, log->rotateCount is 15
|
|
|
|
+dateext suffix '-20220523'
|
|
|
|
+glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
|
|
|
|
+glob finding old rotated logs failed
|
|
|
|
+fscreate context set to unconfined_u:object_r:usr_t:s0
|
|
|
|
+renaming /usr/local/src/nohup.out to /usr/local/src/nohup.out-20220523
|
|
|
|
+creating new /usr/local/src/nohup.out mode = 0600 uid = 0 gid = 0
|
|
|
|
+running postrotate script
|
|
|
|
+[root@localhost logrotate.d]# ps aux
|
|
|
|
+[root@localhost logrotate.d]# ps -le
|
|
|
|
+[root@localhost logrotate.d]# top
|
|
|
|
+top - 17:03:16 up 14 days, 1:15, 5 users, load average: 0.23, 0.19, 0.16
|
|
|
|
+Tasks: 167 total, 1 running, 163 sleeping, 3 stopped, 0 zombie
|
|
|
|
+%Cpu(s): 2.0 us, 2.4 sy, 0.0 ni, 95.6 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 s
|
|
|
|
+KiB Mem : 3564524 total, 1326808 free, 907764 used, 1329952 buff/cache
|
|
|
|
+KiB Swap: 8388604 total, 8388604 free, 0 used. 2382316 avail Mem
|
|
|
|
+
|
|
|
|
+ PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
|
|
|
+11375 root 20 0 159220 6028 4324 S 1.0 0.2 0:26.02 sshd
|
|
|
|
+11572 root 20 0 162916 3076 1572 S 0.7 0.1 0:09.41 top
|
|
|
|
+29422 root 20 0 159220 6036 4324 S 0.7 0.2 3:11.69 sshd
|
|
|
|
+ 9 root 20 0 0 0 0 S 0.3 0.0 22:31.97 rcu_sched
|
|
|
|
+ 439 root 20 0 0 0 0 S 0.3 0.0 11:16.57 xfsaild/+
|
|
|
|
+ 525 root 20 0 16336 1348 1148 S 0.3 0.0 3:18.33 lldpad
|
|
|
|
+ 4879 root 20 0 4774312 591344 24724 S 0.3 16.6 2:07.52 java
|
|
|
|
+[root@localhost logrotate.d]# top -p 4897
|
|
|
|
+ PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
|
|
|
+ 4897 root 20 0 4787676 594772 24732 S 0.3 16.7 2:13.33 Common-C+
|
|
|
|
+[root@localhost logrotate.d]# vmstat
|
|
|
|
+procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
|
|
|
|
+ r b swpd free buff cache si so bi bo in cs us sy id wa st
|
|
|
|
+ 1 0 0 1316272 2116 1332492 0 0 0 1 7 0 0 0 99 0 0
|
|
|
|
+[root@localhost logrotate.d]# free
|
|
|
|
+ total used free shared buff/cache available
|
|
|
|
+Mem: 3564524 913488 1315288 39892 1335748 2376584
|
|
|
|
+Swap: 8388604 0 8388604
|