January 22, 2003
logs and timestamps
For anyone out there muddling through log files and apache's rotatelog format here's a tip. Apache creates that number based on the number of minutes at UTC. That is, it doesn't base it on your local time. It bases it on midnight of your day in UTC. Here's a quick way to get such a number:
date +%s -u -d "`date -u +%D`"What I'm doing here is first running date and asking for just a short date in UTC. Then I'm feeding that result back up to date and asking for a response in seconds.
Although, you may want to be sure your machine is using the right time values. This is made doubly difficult on some systems. I had the agony of discovering the linux tools for date handling are broken. This after wasting a boatload of time check and rechecking various timezone, hardware clock and other settings. All for naught when I found out that /bin/date was broken. Arrrghhh!
Comments







