| | 24 | |
| | 25 | == logrotate == |
| | 26 | we can config naemon.log to rotate as following |
| | 27 | {{{ |
| | 28 | #!sh |
| | 29 | OMD[monitor@906094f86a76]:~/etc/logrotate.d$ more /omd/sites/monitor/etc/logrotate.d/naemon |
| | 30 | /omd/sites/monitor/var/naemon/naemon.log { |
| | 31 | daily |
| | 32 | rotate 7 |
| | 33 | nocompress |
| | 34 | olddir /omd/sites/monitor/var/naemon/archive |
| | 35 | dateext |
| | 36 | dateformat -%Y%m%d |
| | 37 | missingok |
| | 38 | notifempty |
| | 39 | postrotate |
| | 40 | [ -f /omd/sites/monitor/tmp/lock/naemon.lock ] && kill -s USR1 `cat /omd/sites/monitor/tmp/lock/naemon.lock` |
| | 41 | endscript |
| | 42 | create 0664 monitor monitor |
| | 43 | } |
| | 44 | |
| | 45 | /omd/sites/monitor/var/naemon/livestatus.log { |
| | 46 | missingok |
| | 47 | rotate 0 |
| | 48 | compress |
| | 49 | delaycompress |
| | 50 | notifempty |
| | 51 | create 640 monitor monitor |
| | 52 | } |
| | 53 | |
| | 54 | }}} |
| | 55 | |
| | 56 | A file thruk.log was an activity user log. We can logrotate as following |
| | 57 | {{{ |
| | 58 | #!sh |
| | 59 | OMD[monitor@906094f86a76]:~/etc/logrotate.d$ more /omd/sites/monitor/etc/logrotate.d/thruk |
| | 60 | /omd/sites/monitor/var/log/thruk.log { |
| | 61 | daily |
| | 62 | rotate 3 |
| | 63 | nocompress |
| | 64 | olddir /omd/sites/monitor/var/log/archive |
| | 65 | dateext |
| | 66 | dateformat -%Y%m%d |
| | 67 | missingok |
| | 68 | notifempty |
| | 69 | create 660 monitor monitor |
| | 70 | } |
| | 71 | |
| | 72 | /omd/sites/monitor/var/thruk/cron.log { |
| | 73 | missingok |
| | 74 | rotate 0 |
| | 75 | compress |
| | 76 | delaycompress |
| | 77 | notifempty |
| | 78 | create 660 monitor monitor |
| | 79 | } |
| | 80 | |
| | 81 | }}} |