Log management
By default, log entries are printed on the console (stdout). It is possible to write logs to a file by using the logDestinations and logFile settings:
# Destinations of log messages; available values are "stdout", "file" and "syslog".
logDestinations: [file]
# If "file" is in logDestinations, this is the file which will receive the logs.
logFile: mediamtx.logThe log file can be periodically rotated or truncated by using an external utility.
On most Linux distributions, the logrotate utility is in charge of managing log files. It can be configured to handle the MediaMTX log file too by creating a configuration file, placed in /etc/logrotate.d/mediamtx, with this content:
/my/mediamtx/path/mediamtx.log {
daily
copytruncate
rotate 7
compress
delaycompress
missingok
notifempty
}This file will rotate the log file every day, adding a .NUMBER suffix to older copies:
mediamtx.log.1
mediamtx.log.2
mediamtx.log.3
...