By default, the Wowza Streaming Engine™ media server software logs roll over after one day if there's new activity. This article describes how to roll over the log files (wowzastreamingengine_access.log, wowzastreamingengine_error.log, wowzastreamingengine_stats.log) at a custom interval for Wowza Streaming Engine 4.8.8.01 or later.
Notes:
- The instructions in this article apply to Wowza Streaming Engine 4.8.8.01 and later. For instructions on configuring log rolling for Wowza Streaming Engine 4.7.7 through 4.8.5, see Configure Wowza Streaming Engine log rolling (legacy).
- For instructions on configuring log rolling for Wowza Streaming Engine 4.7.6 or earlier, see Configure Wowza Streaming Engine log rolling by time and size (legacy).
About log rollover
Wowza Streaming Engine 4.8.8.01 and later uses the Apache Log4J 2 framework for a logging implementation. By default, every 24 hours each log file is archived and a new one is created. After 5 days, the oldest log file is deleted. Using the Log4J 2 RollingFileAppender Composite Triggering Policy, you can combine one or more methods of controlling log rollover.
Configure log rollover
- Navigate to [install-dir]/conf/ and open log4j2-config.xml in a text editor.
- In each <RollingFile> element that you want to include a custom rollover interval for, update the <Policies> block.
- Use <TimeBasedTriggeringPolicy />, the default, to use a time interval to determine when the log file rolls over. If necessary, edit the <IfLastModified> age attribute to adjust the time interval after which the oldest file is deleted.
<Policies> <TimeBasedTriggeringPolicy /> </Policies> <DefaultRolloverStrategy> <Delete basePath="${sys:com.wowza.wms.ConfigHome}/logs/${ctx:x-vhost}/${ctx:x-app}" maxDepth="1"> <IfLastModified age="5d" /> </Delete> </DefaultRolloverStrategy>
- Use <SizeBasedTriggeringPolicy /> and set a size attribute to use the size of the log file to determine when the log file rolls over.
<Policies> <SizeBasedTriggeringPolicy size="10 MB" /> </Policies>
If using size-based triggering, in the <RollingFile> element, edit the filePattern attribute for the appender to append -%i to the end. For example:filePattern="${sys:com.wowza.wms.ConfigHome}/logs/wowzastreamingengine_access.log.%d{yyyy-MM-dd}-%i"
- Use <TimeBasedTriggeringPolicy />, the default, to use a time interval to determine when the log file rolls over. If necessary, edit the <IfLastModified> age attribute to adjust the time interval after which the oldest file is deleted.
- Save your changes and restart Wowza Streaming Engine.