Working with Wowza logs
Improve logs management and rotation over linux, combining Log4j and LogRotate.
Modify the log4j.properties for using other Appender:
# Access appender log4j.appender.serverAccess=org.apache.log4j.RollingFileAppender log4j.appender.serverAccess.File=${com.wowza.wms.ConfigHome}/logs/wowzamediaserver_access.log log4j.appender.serverAccess.layout=com.wowza.wms.logging.ECLFPatternLayout 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
Create the logrotate configuration file into Centos/RedHat the path is:
nano /etc/logrotate.d/wowza
/usr/local/WowzaMediaServer/logs/*.log { rotate 3 size=512M compress copytruncate missingok }
And the last step is you have very big logs files like is my case, and into one day I can have 2 GB of logs or more, move the log rotate for check every hour instead of every day
mv /etc/cron.daily/logrotate /etc/cron.hourly/
Inspired in this post: http://nicerhttpd.blogspot.com/2008/11/logrotate-and-log4j.html
UPDATE:
Other way to work with Wowza logs, can be using external Jar for rotate the logs by Size and Time, this way if you are running into WinOS or don’t like to use LogRotate for this task can have similar functionality
For more details can check the Wowza Forum post: http://www.wowza.com/forums/content.php?263-Logging-How-to-use-TimeAndSizeRollingAppender