Manually Rotating an Aerospike Log File
Log rotation is managed by
systemd-journald, and in normal operations you don't have to pay attention to it. However, there are some use cases for manual file rotation, such as:
- Free up storage space.
- Separate debugging logs.
- Move log files to a different location.
Follow these steps to manually rotate the log file. The following steps use
/var/log/aerospike/aerospike.log for the example log file.
Move the existing log file to a new location, which is anywhere you want:
mv /var/log/aerospike/aerospike.log /var/log/aerospike/aerospike-old.log
asd(Aerospike daemon) process ID. In systemd environments use the
The expected output is a process number, for example:
In non-systemd environments read its pidfile:
Send a SIGHUP to the
kill -s SIGHUP 3513
The following message is printed at the end of the old log file:
SIGHUP received, rolling log
Aerospike re-creates the original log file, and only new messages appear in it.
Finding the log ID and log file location
asinfo to find the log IDs and log file locations:
asinfo -v "logs" -l
The example output shows that there is a log file at
/var/log/aerospike/aerospike.log, and a second logging stream directed to stderr. See Configuring Log Files for more information.