Question
Platform logs take up a lot of space. How can I reduce the log volume?
Answer
The following recommendations will help you optimize platform logs.
Reducing the logging level
Reduce the logging level. The higher the logging level, the more detailed information is written to the log, and the more space the log files take up. For more information, see the article Logging in BILLmanager.
Automatic log deletion
Set up automatic deletion of old logs (rotation):
- Open the section Settings → System settings → block Log storage settings.
- Set the required values in the following fields:
- Keep the log, days — how many days logs will be stored in the operations log billmgr.journal;
You can edit the value:
- via the web interface according to the instructions above;
- via the configuration file /usr/local/mgr5/etc/billmgr.conf. The ExpireLogsDays parameter is responsible for storing logs in the operations log. The default value is 365. For more information, see the article Configuration file parameters.
- Keep logs, days — how many days logs will be stored in the archive.
- Keep the log, days — how many days logs will be stored in the operations log billmgr.journal;
- Click Ok to save the changes.
For more information about the operations log and rotation setup, see the article Logs.
Rotation of the operations log billmgr.journal
Set up manual rotation of the operations log billmgr.journal using the mv utility.
Rotation via mv allows you to keep the current log and continue writing to a new file without restarting the platform. Rotation may be required if:
- the storage settings are insufficient to contain the log growth (for more information about the settings, see the section Automatic log deletion);
- you need to keep copies of the log for separate periods (for example, daily);
- the log file size has exceeded the allowed limit and affects the platform performance.
All commands in this section are executed on the server with the platform. For more information about connecting via SSH, see Workstation setup.
To check the file size, run the command:
du -h /usr/local/mgr5/var/billmgr.journal200G /usr/local/mgr5/var/billmgr.journalIf the file size exceeds the allowed limit, set up rotation. If there is no excess, you can set up rotation in advance to limit the maximum file size.
To set up rotation, move the log file:
- Stop the kernel processes:
The command ensures that nothing is written to the log at the moment the file is moved. This eliminates data loss. After the move, the platform resumes operation automatically.killall core - Move the log file:
Explanation:mv /usr/local/mgr5/var/billmgr.journal /usr/local/mgr5/var/logs/billmgr.journal-$(date +%G-%m-%d-%H-%M-%S)/usr/local/mgr5/var/billmgr.journal— the source log file;/usr/local/mgr5/var/logs/billmgr.journal-$(date +%G-%m-%d-%H-%M-%S)— the path and name under which the moved log is saved.$(date ...)substitutes the current date and time in the formatYYYY-MM-DD-HH-MM-SSso that each file name is unique. For example, for September 18, 2026, 14:30:00, the file will be namedbillmgr.journal-2026-09-18-14-30-00.
After running the command:
-
- the current log is moved to the folder /usr/local/mgr5/var/logs/;
- the old log is saved in full;
- the platform automatically creates a new empty file billmgr.journal and writes all subsequent events to it.
If billmgr.journal has exceeded the allowed size (for example, about 200 GB) and it is not possible to move it, keep only the latest records. For example, the last 100 lines:
- Save the latest log records to a temporary file:
Explanation:tail -n 100 /usr/local/mgr5/var/billmgr.journal > /tmp/billmgr_tail.tmp-n 100— the number of latest records that will remain in the operations log (in the example — 100);/usr/local/mgr5/var/billmgr.journal— the operations log file;/tmp/billmgr_tail.tmp— a temporary file where the last 100 lines of the log are saved.
- Overwrite the saved records back to billmgr.journal:
cat /tmp/billmgr_tail.tmp > /usr/local/mgr5/var/billmgr.journal - Delete the temporary file:
As a result, only the last 100 records will remain in the operations log. This will reduce the file size.rm /tmp/billmgr_tail.tmp
Related topics:
En
Es