Configure Wowza Streaming Engine log rolling by time and size (legacy)

By default, the Wowza Streaming Engine™ media server software logs roll over daily if there's new activity. This article describes how to roll over the access log file (wowzastreamingengine_access.log) for Wowza Streaming Engine 4.7.6 or earlier at a precise time or size.

Note:

Roll over logs by time


  1. Open the [install-dir]/conf/log4j.properties file in a text editor and ensure that the first entry in the Access appender section is:
     
    log4j.appender.serverAccess=org.apache.log4j.DailyRollingFileAppender
    

    If RollingFileAppender is enabled, comment it out. For example:

    log4j.appender.serverAccess=org.apache.log4j.DailyRollingFileAppender
    #log4j.appender.serverAccess=org.apache.log4j.RollingFileAppender
  2. In the Access appender section, update the date pattern in the following line to the specified time duration at which log files should roll over.

    For example, to change the DatePattern to enable rollover every minute:

    log4j.appender.serverAccess.DatePattern='.'yyyy-MM-dd-hh-mm

The Access appender section of your log4j.properties file should now look like this:

# Access appender
log4j.appender.serverAccess=org.apache.log4j.DailyRollingFileAppender
#log4j.appender.serverAccess=org.apache.log4j.RollingFileAppender
log4j.appender.serverAccess.DatePattern='.'yyyy-MM-dd-hh-mm
log4j.appender.serverAccess.File=${com.wowza.wms.ConfigHome}/logs/wowzastreamingengine_access.log
log4j.appender.serverAccess.layout=com.wowza.wms.logging.ECLFPatternLayout
#log4j.appender.serverAccess.layout.Fields=x-severity,x-category,x-event;date,time,c-client-id,c-ip,c-port,cs-bytes,sc-bytes,x-duration,x-sname,x-stream-id,x-spos,sc-stream-bytes,cs-stream-bytes,x-file-size,x-file-length,x-ctx,x-comment
log4j.appender.serverAccess.layout.Fields=date,time,tz,x-event,x-category,x-severity,x-status,x-ctx,x-comment,x-vhost,x-app,x-appinst,x-duration,s-ip,s-port,s-uri,c-ip,c-proto,c-referrer,c-user-agent,c-client-id,cs-bytes,sc-bytes,x-stream-id,x-spos,cs-stream-bytes,sc-stream-bytes,x-sname,x-sname-query,x-file-name,x-file-ext,x-file-size,x-file-length,x-suri,x-suri-stem,x-suri-query,cs-uri-stem,cs-uri-query
log4j.appender.serverAccess.layout.OutputHeader=true
log4j.appender.serverAccess.layout.QuoteFields=false
log4j.appender.serverAccess.layout.Delimeter=tab

  1. Restart Wowza Streaming Engine.

Roll over logs by size


  1. Open the [install-dir]/conf/log4j.properties file in a text editor and ensure that the first enabled entry in the Access appender section is:
     
    log4j.appender.serverAccess=org.apache.log4j.RollingFileAppender

    If DailyRollingFileAppender is enabled, comment it out. For example:
     
    #log4j.appender.serverAccess=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.serverAccess=org.apache.log4j.RollingFileAppender
  2. Add the following line to the bottom of the Access appender section:
     
    log4j.appender.serverAccess.MaxFileSize=100KB
    

    This line instructs Wowza Streaming Engine to create a new log file when the current log reaches 100 KB. You can change this to a maximum of 204800 KB (200 MB) or another more reasonable size for your setup.

  3. Add the following line directly under the new entry that you added in the previous step, and change 10 to the maximum number of log files that you want to store at the specified size:
     
    log4j.appender.serverAccess.MaxBackupIndex=10

The Access appender section of your log4j.properties file should now look something like this:

# Access appender
#log4j.appender.serverAccess=org.apache.log4j.DailyRollingFileAppender
log4j.appender.serverAccess=org.apache.log4j.RollingFileAppender
log4j.appender.serverAccess.DatePattern='.'yyyy-MM-dd
log4j.appender.serverAccess.File=${com.wowza.wms.ConfigHome}/logs/wowzastreamingengine_access.log
log4j.appender.serverAccess.layout=com.wowza.wms.logging.ECLFPatternLayout
#log4j.appender.serverAccess.layout.Fields=x-severity,x-category,x-event;date,time,c-client-id,c-ip,c-port,cs-bytes,sc-bytes,x-duration,x-sname,x-stream-id,x-spos,sc-stream-bytes,cs-stream-bytes,x-file-size,x-file-length,x-ctx,x-comment
log4j.appender.serverAccess.layout.Fields=date,time,tz,x-event,x-category,x-severity,x-status,x-ctx,x-comment,x-vhost,x-app,x-appinst,x-duration,s-ip,s-port,s-uri,c-ip,c-proto,c-referrer,c-user-agent,c-client-id,cs-bytes,sc-bytes,x-stream-id,x-spos,cs-stream-bytes,sc-stream-bytes,x-sname,x-sname-query,x-file-name,x-file-ext,x-file-size,x-file-length,x-suri,x-suri-stem,x-suri-query,cs-uri-stem,cs-uri-query
log4j.appender.serverAccess.layout.OutputHeader=true
log4j.appender.serverAccess.layout.QuoteFields=false
log4j.appender.serverAccess.layout.Delimeter=tab
log4j.appender.serverAccess.MaxFileSize=100KB
log4j.appender.serverAccess.MaxBackupIndex=10

  1. Restart Wowza Streaming Engine.