Manually Rotating the Aerospike Log File
Log rotation is managed by systemd-journald
, and usually you don't have to pay attention to it. However, there are some use cases for manual file rotation. You might want to rotate a log to free up space, or to separate debugging information from routine operations.
Follow these steps to manually rotate the log file. The following steps use /var/log/aerospike.log
for the example log file.
- Move the existing log file to a new location:
mv /var/log/aerospike.log /var/log/aerospike-old.log
- Find the
asd
(Aerospike daemon) process ID:
pidof asd
The expected output is a process number, for example:
3513
In non-systemd environments it can be found in the pidfile:
cat /var/run/aerospike/asd.pid
- Send a SIGHUP to the
asd
process:kill -s SIGHUP 3513
In the old log file you will see the following message:
SIGHUP received, rolling log
This should be the last message in the file. Aerospike will re-create the original log file, and all new messages will appear in it.
Finding the log IDs and log file location
Use asinfo
to find the log IDs, and their locations:
asinfo -v "logs"
Expected output:
0:/var/log/aerospike.log;1:stderr
The example output shows that there is a log file at /var/log/aerospike.log
, and a second logging stream directed to stderr. Refer to Configuring Log Files../configure_log_files.md) for more information.