This article addresses Journal daemon usage and configuration as it relates to Aerospike. If you choose to configure Aerospike to log to journald, you should find this article helpful. Use of journald is optional. See http://www.aerospike.com/docs/operations/manage/systemd#managing-server-logs-under-systemd- for details.
- Are Journal files stored somewhere?
The default location for Journal files is /run/log/journal. When you configure /etc/systemd/journald.conf to use persistent storage, files are stored in /var/log/journal, and fallback to /run/log/journal. /run/log/journal is used for logging during early boot when the disk is not yet writable.
Can you still use /var/log/aerospike/aerospike.log?
Yes, you can still use /var/log/aerospike/aerospike.log but it is not recommended as journal files are more compact and efficient. You also need to manually setup log rotation.
How often do logs rotate?
Journal rotates logs according to the configurations in /etc/systemd/journald.conf. You can configure logs to rotate based upon file size, directory size, and age of logs. You can also configure logs to live in memory and to not persist after reboot.
If you configure logs to rotate based on file size, Journal governs file size with the configuration SystemMaxFileSize in journald.conf. This configuration sets a maximum file size for Journal files. SystemMaxUse sets the maximum storage allocated for Journal files. You can set values in the following units: K, M, G, T, P, E
You can also use Maxfilesec to set a maximum age for entries in a single Journal file before rotating to the next one. This setting can be in: year, month, day, hour, or minute. MaxRetentionSec sets the maximum age for stored Journal files.
Aerospike suggests that you configure journald.conf to rotate logs daily and to keep the logs for 90 days.
- How can you review prior logs?
When you review Journal files with
journalctl, prior logs are automatically included. If the time period that you are reviewing spans two or more Journal files,
journalctl displays the entries seamlessly.
- How should we configure Journal rotation?
Aerospike suggests that you configure journald.conf to rotate logs every 24 hours, and to keep the logs for 90 days. You can refer to the sample journald.conf file at the end of this document.
- What is the role of persistence in Journal?
Persistence determines if and where you store the Journal files. You can modify /etc/systemd/journald.conf to configure persistence.
If you configure ‘Storage=’ to ‘none’, Journal does not keep data. If you configure it to ‘volatile’, Journal data is only held in memory. If you configure it to ‘persistent’, logs are held in /var/log/journal and use /run/log/journal for fallback during early boot, if needed.
Aerospike suggested configurations for /etc/systemd/journald.conf:
# This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # See journald.conf(5) for details [Journal] Storage=auto # Compress=yes # Seal=yes # SplitMode=login # SyncIntervalSec=5m # RateLimitInterval=30s # RateLimitBurst=1000 SystemMaxUse=2G # SystemKeepFree= # SystemMaxFileSize= # RuntimeMaxUse= # RuntimeKeepFree= # RuntimeMaxFileSize= MaxRetentionSec=90day MaxFileSec=24h # ForwardToSyslog=yes # ForwardToKMsg=no # ForwardToConsole=no # TTYPath=/dev/console # MaxLevelStore=debug # MaxLevelSyslog=debug # MaxLevelKMsg=notice # MaxLevelConsole=info
- ‘Storage=auto’ persists Journal files and stores them in /var/log/journal
- ‘MaxFileSec=24h’ stores individual Journal files for 24 hours before rotating to a new Journal file.
- ‘MaxRetentionSec=90day’ Maximum time to store Journal files.