Post Aerospike 3.8 XDR logs do not rotate

The Aerospike Knowledge Base has moved to https://support.aerospike.com. Content on https://discuss.aerospike.com is being migrated to either https://support.aerospike.com or https://docs.aerospike.com. Maintenance on articles stored in this repository ceased on December 31st 2022 and this article may be stale. If you have any questions, please do not hesitate to raise a case via https://support.aerospike.com.

Post Aerospike 3.8 XDR logs do not rotate

Problem Description

In Aerospike 3.8 and higher XDR functionality is contained within the main Aerospike process (asd) and so by default, XDR logs are written to the main aerospike.log. It is possible, if desired, to continue writing XDR log messages to a separate asxdr.log file. In this configuration, when log rotate rotates the log file, asxdr.log may not rotate properly.

Explanation

This is caused by the fact that there is no separate asxdr process anymore. When log rotate rotates the log file it issues a hup to the Aerospike process as follows:

postrotate
kill -HUP `pidof asd`
endscript

When this command runs, after rotation of aerospike.log both logs are truncated.

Solution

The solution to this issue is to replace the hup with the following command:

postrotate
copytruncate
endscript

The copytruncate command tells logrotate to copy the file and truncate in place rather than sending a hup

Notes

  • Logrotate man page:

http://www.linuxcommand.org/man_pages/logrotate8.html

  • Retaining asxdr.log in post 3. XDR architecture.

http://www.aerospike.com/docs/operations/upgrade/xdr_to_3_8

Keywords

XDR ASXDR LOGGING LOGROTATE

Timestamp

12st September 2016