Skip to main content
January 24, 2013
Answered

How to rotate Apache2.2/logs/access_log without restarting AMS 5.0.1 on AWS.

  • January 24, 2013
  • 1 reply
  • 3960 views

The Adobe Media Server 5.0.1 docs say that Logging.xml controls rotating of the Apache access_log file but its not rotating and I don't see how to configure it in Logging.xml.

Logging.xml takes care of the AMS log files like Access.log but it doens't seem to handle the Apache logs. I've seen where you use logrotated to rotate the Apache logs, then issue a "reload" to the service, but AMS controls Apache and the AMS service only supports start, stop, and reload which takes a minimum of 5 to 10 seconds to reload the server. How can I rotate the Apache logs using Logger.xml or how can I issue a reload directly to Apache when the AMS scripts control it?

http://help.adobe.com/en_US/adobemediaserver/configadmin/WS5b3ccc516d4fbf351e63e3d119f29260bd-7ffa.2.3.html

This topic has been closed for replies.
Correct answer Michael_Kennedy__12345_

You could use rotatelogs instead of cronolog. Rotatelogs is installed with the AMS/FMS install of Apache. It is documented here: http://httpd.apache.org/docs/2.2/programs/rotatelogs.html. The above example would become:

CustomLog "|/opt/adobe/ams/Apache2.2/bin/rotatelogs /mnt/ams/Apache2.2/logs/access_log.%Y%m%d 86400" combined

You will need to write your own scripts to manage these logs so that your disks do not fill up. The following two lines in your crontab will compress files older than 1 day, and delete compressed logs after 30 days.

@daily find /mnt//ams/Apache2.2/logs/ -type f -name '*.gz' -mtime +30 -delete

@daily for file in `find /mnt/ams/Apache2.2/logs/ -not -name '*.gz' -mmin +1440`;do gzip --best $file;done

1 reply

Known Participant
January 25, 2013

To rotate the apache logs you need to pipe them through a third party tool (i saying that there may be something in apache I may have read once, however here is a tried and tested solution assuming you are on linux), Logging.xml is only for FMS (well it was for 4.5.5 and before).

  1. Download cronolog (http://cronolog.org/)
  2. Change your log directive
    1. From: CustomLog "logs/access.log" combined
    2. To: CustomLog "| /mnt/apps/cronolog/sbin/cronolog -S /mnt/fms/Apache2.2/logs/access_log /mnt/fms/Apache2.2/logs/%Y%m%d_access.log" combined
  3. Restart apache
  4. You logs will now roll daily on the first time they are written to
    1. ie the logs dont roll at midnight, but the first time they are written to after midnight (so if no one access your server on a day, there will be no log for that day)

The above example makes the assumptiosn:

  1. FMS apache is installed in /mnt/fms/Apache2.2 and you want to use its log dir
  2. cronolog installed in /mnt/apps/cronolog/
Inspiring
January 25, 2013

You could use rotatelogs instead of cronolog. Rotatelogs is installed with the AMS/FMS install of Apache. It is documented here: http://httpd.apache.org/docs/2.2/programs/rotatelogs.html. The above example would become:

CustomLog "|/opt/adobe/ams/Apache2.2/bin/rotatelogs /mnt/ams/Apache2.2/logs/access_log.%Y%m%d 86400" combined

You will need to write your own scripts to manage these logs so that your disks do not fill up. The following two lines in your crontab will compress files older than 1 day, and delete compressed logs after 30 days.

@daily find /mnt//ams/Apache2.2/logs/ -type f -name '*.gz' -mtime +30 -delete

@daily for file in `find /mnt/ams/Apache2.2/logs/ -not -name '*.gz' -mmin +1440`;do gzip --best $file;done

Known Participant
January 25, 2013

A yes that was it rotatelogs!