Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to force logrotate to use UTC time for one configuration? I need the dateext to be set to UTC. I was hoping it was as simple as setting a date varible. Should I just run postrotate and mv the files to a new file name that puts the UTC time on after the fact. I'm just looking for a best practice or the most practical solution. Thanks in advance.

My cute attempt to cheap out with a setting a variable. :)

/var/log/bricks/*.log {
DATE=`date -u +%Y%m%d`
dateformat .%Y%m%d
share|improve this question
up vote 3 down vote accepted

Have you thought of generating two configurations and run logrotate normally for one configuration.

For the UTC configuration, run logrotate through a wrapper:

  #! /bin/sh
  export TZ
  export PATH
  logrotate -s /var/lib/gmt-logrotate.status gmt-logrotate.cfg
  exit $?

By breaking them up, you can seperate the times you run each of the logrotate configurations.

share|improve this answer
Very smart. I didn't think of that. I'll look into it since it will give me a little more flexibility. – egorgry Feb 14 '12 at 18:01
just implemented this and it works like a charm. Thanks! – egorgry Feb 14 '12 at 21:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.