Airwave stores logs for every event that occurs. These logs are the key to understand an issue and will be the best place to start the debugging process. This article will help understand how the logs are rotated and what can be done to change the settings to best improve debugging an issue if encountered on Airwave.
The file responsible for storing the log rotation details in Linux or CentOS is logrotate.conf by default. Since Airwave is built on a custom CentOS platform the log rotate file is stored in /etc/logrotate.d/ and is named as amp.
One might want certain logs to have bigger size for the purpose of debugging.
In such cases the following field corresponding to the log file to be edited needs to be changed in the amp file:
size=4M # Size of the log file will be 4MB max
All log files in Airwave are mentioned in the amp file under /etc/logrotate.d/, so be sure to select the right log settings to be edited.
Once the changes are made to the amp file, save the changes using the following command.
Press Esc-->Type :wq!-->Hit Enter
It is not recommended to set the rotate value to 0 which disables the rotation feature. If set to 0 the disk space will at one point be full. Ensure it is atleast set to 1.
On opening the amp file using vi or vim editor the following lines are seen(only a snippet has been added since the file is large):
/sbin/fixfiles restore /var/log/async_logger_client_by_topic > /dev/null 2>&1
/sbin/pidof -x Daemon::AsyncLoggerClient::ByTopic | /usr/bin/xargs -r /bin/kill -USR2
Below are the details of each line and what it does:
/var/log/async_logger_client_by_topic : Indicates the name of the log file
missingok : If the log file is missing, go on to the next one without issuing an error message.
size=1M : Total size of the log file permitted
rotate 1: Log files are rotated once before being removed or mailed to the address specified in a mail directive. If count is 0, old versions are removed rather then rotated.
pre and post rotate: The lines between pre rotate and end script are executed after the log file is rotated. These directives may only appear inside a log file definition.
Please be sure to revert the changes made once the debugging is complete. You can make a copy of the amp file before any changes are made for reference purpose.
In this example we changed the size value of async_logger_client_by_topic log file to 4MB. Login to Airwave GUI and navigate to System-->Status page and check the same log listed and you will the log file will be 4MB in size.