User Tools

Site Tools


aix:logrotate

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
aix:logrotate [2021/01/01 21:21]
127.0.0.1 external edit
aix:logrotate [2023/08/08 17:58] (current)
manu
Line 43: Line 43:
 # RPM packages drop log rotation information into this directory # RPM packages drop log rotation information into this directory
 include /​etc/​logrotate.d include /​etc/​logrotate.d
- +</​cli>​ 
 +<cli prompt='>'>​
 [eco-aix61@root] /​var/​log>​ cat /​etc/​logrotate.d/​system.conf [eco-aix61@root] /​var/​log>​ cat /​etc/​logrotate.d/​system.conf
 # Most common AIX files # Most common AIX files
Line 82: Line 82:
     weekly     weekly
     rotate 4     rotate 4
-    ​postrotate +    ​olddir ​/var/log/news/old
-         for myfile in $(ls /var/spool/mail/* | grep -v '​\.gz'​) +
-         do +
-           ​filename=$(echo $myfile | rev | cut -d'/'​ -f1 | rev) +
-           chown ${filename}:​mail $myfile +
-           chmod 660 $myfile +
-         ​done;​ +
-    endscript+
 } }
- 
 </​cli>​ </​cli>​
  
Line 107: Line 99:
 In case of trouble, start manually logrotate with debug and verbose options: In case of trouble, start manually logrotate with debug and verbose options:
   /​usr/​sbin/​logrotate -dv /​etc/​logrotate.conf   /​usr/​sbin/​logrotate -dv /​etc/​logrotate.conf
 +  ​
 +Change compression program
 +<cli prompt='>'>​
 +/​tmp/​output.log {
 +        size 1k
 +        copytruncate
 +        create
 +        compress
 +        compresscmd /bin/bzip2
 +        compressext .bz2
 +        rotate 4
 +}
 +</​cli>​
 +
 +===== Delete a specific log file =====
 +
 +<cli prompt='​$'>​
 +$ cat /​etc/​logrotate.d/​app
 +
 +/​var/​log/​app/​*.old {
 +  hourly
 +  rotate 0
 +  firstaction
 +    /​usr/​bin/​find /​var/​log/​app/​ -name "​*.old"​ -mtime +1 -delete
 +  endscript
 +  nocreate
 +  missingok
 +  notifempty
 +}
 +</​cli>​
aix/logrotate.1609532505.txt.gz · Last modified: 2021/01/01 21:21 by 127.0.0.1