- Published on
- • 2 min read
Changing Kannel Log Level & Log Rotation
- Authors

- Name
- Shaiju Edakulangara
- @eshaiju
If Kannel is configured so that the bearerbox, wapbox, and/or smsbox log to file, each of these log files will continue to grow unless administered in some way. One way of reducing logs is by changing the log level. Kannel allows you to have 5 log levels (0 - debug, 1 - info, 2 - warning, 3 - error, 4 - panic). You can change the log level by editing the log-level component in the configuration file or by using an admin HTTP command without restarting bearerbox.
http://localhost:13000/log-level?password=bar&level=2
Another way of administering log files is to 'rotate' the logs on a regular basis using a tool such as logrotate. A sample logrotate script is shown below.
Setup Logrotate
Step 1: If logrotate is not already on your system, install it now.
sudo apt-get install logrotate
Step 2: Add the following script to the file /etc/logrotate.d/kannel:
/var/log/kannel/*.log {
daily
missingok
rotate 365
compress
delaycompress
notifempty
create 640 kannel adm
sharedscripts
postrotate
killall -HUP bearerbox smsbox wapbox || true > /dev/null 2> /dev/null
endscript
}
In this example, the Kannel log files found in /var/log/kannel are rotated and compressed daily over 365 days. To verify if a particular log is rotating or not and to check the last date and time of its rotation, check the /var/lib/logrotate/status file.
cat /var/lib/logrotate/status