Add instructions about logrotate.d

Add description of using logrotate.d and give the default logrotate.d script.
This commit is contained in:
Alloy Networks
2019-06-15 12:06:03 +03:00
committed by GitHub
parent 0c88b34cbb
commit 1aaccce11f

View File

@@ -1,7 +1,31 @@
# logrotate
[[Source]<br>](https://github.com/ripple/rippled/blob/743bd6c9175c472814448ea889413be79dfd1c07/src/ripple/rpc/handlers/LogRotate.cpp "Source")
The `logrotate` command closes and reopens the log file. This is intended to help with log rotation on Linux file systems.
The `rippled logrotate` command closes and reopens the log file. This is intended to help with log rotation on Linux file systems.
Most linux systems come preinstalled with `logrotate`. Application specific log rotation scripts are placed in `/etc/logrotate.d`
The following script is a sample that can be created as /etc/logrotate.d/rippled
```
/var/log/rippled/*.log {
daily
minsize 200M
rotate 7
nocreate
missingok
notifempty
compress
compresscmd /usr/bin/nice
compressoptions -n19 ionice -c3 gzip
compressext .gz
postrotate
/opt/ripple/bin/rippled --conf /opt/ripple/etc/rippled.cfg logrotate
endscript
}
```
Parameters such as `minsize` and `rotate` can be changed depending on the `log_level` set in `rippled.cfg`. This sample script is based on standard `log_level` and will store approximately 2 weeks worth of logs in a compressed format.
**Note:** Only one system logrotate script should exist per application. Please ensure that you do not have any other log rotation that handles the same directory.
_The `logrotate` method is an [admin method](admin-rippled-methods.html) that cannot be run by unprivileged users._