b45f2845a44c8dab00f450694752c7130117abb7
technology/linux/general/index.md
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | - [dmidecode](dmidecode) |
| 7 | 7 | - [i3lock](i3lock) |
| 8 | 8 | - [journalctl](journalctl) |
| 9 | +- [logrotate](logrotate) |
|
| 9 | 10 | - [man_pages](man_pages) |
| 10 | 11 | - [mpd](mpd) |
| 11 | 12 | - [mpv](mpv) |
technology/linux/general/logrotate.md
| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | +# logrotate |
|
| 2 | + |
|
| 3 | +[guide and functions][] |
|
| 4 | + |
|
| 5 | +## file example |
|
| 6 | +``` |
|
| 7 | +/var/log/example.log { |
|
| 8 | + weekly |
|
| 9 | + size 500M |
|
| 10 | + missingok |
|
| 11 | + rotate 5 |
|
| 12 | + compress |
|
| 13 | + copytruncate |
|
| 14 | + notifempty |
|
| 15 | +} |
|
| 16 | +``` |
|
| 17 | + |
|
| 18 | +test using debug mode |
|
| 19 | +``` |
|
| 20 | +logrotate -d /etc/logrotate.d/example |
|
| 21 | +``` |
|
| 22 | + |
|
| 23 | +run manually |
|
| 24 | +``` |
|
| 25 | +logrotate -f /etc/logrotate.d/example |
|
| 26 | +``` |
|
| 27 | + |
|
| 28 | +[guide and functions]: https://www.techrepublic.com/article/manage-linux-log-files-with-logrotate/ |