Configure Wowza Streaming Engine log rolling

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.logwowzastreamingengine_stats.log) at a custom interval for Wowza Streaming Engine 4.8.8.01 or later.

Notes:

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


  1. Navigate to [install-dir]/conf/ and open log4j2-config.xml in a text editor.
  2. 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"
    For additional information, see the Rollover Strategies section of the Log4J 2 documentation.
  3. Save your changes and restart Wowza Streaming Engine.