Oracle HTTP Server (Apache) rotatelogs configuration

Is it just me, or does Oracle pick useless defaults? The latest case I encountered (just one of several) is the default Oracle Application Server configuration for logging. Both the HTTP Server ErrorLog and CustomLog use rotatelogs, but if they go so far as to configure rotatelogs, why not make some sensible defaults? Here are … Continue reading “Oracle HTTP Server (Apache) rotatelogs configuration”

Is it just me, or does Oracle pick useless defaults? The latest case I encountered (just one of several) is the default Oracle Application Server configuration for logging. Both the HTTP Server ErrorLog and CustomLog use rotatelogs, but if they go so far as to configure rotatelogs, why not make some sensible defaults?

Here are the defaults I found at a recent OAS 10.1.2.0.2 installation:

ErrorLog "|/u01/oracle/product/10.1.2/midtier/Apache/Apache/bin/rotatelogs /u01/oracle/product/10.1.2/midtier/Apache/Apache/logs/error_log 43200"


CustomLog "|/u01/oracle/product/10.1.2/midtier/Apache/Apache/bin/rotatelogs /u01/oracle/product/10.1.2/midtier/Apache/Apache/logs/access_log 43200" common

My personal favorite practice is to update these parameters so that

  1. The rollover time for each log is somewhere close to midnight (at least for part of the year).
  2. The logfile name makes sense.

Here is what I usually use for my own “default” settings:

ErrorLog "|/u01/oracle/product/10.1.2/midtier/Apache/Apache/bin/rotatelogs /u01/oracle/product/10.1.2/midtier/Apache/Apache/logs/error_log.%Y-%m-%d-%H_%M 86400 -300"


CustomLog "|/u01/oracle/product/10.1.2/midtier/Apache/Apache/bin/rotatelogs /u01/oracle/product/10.1.2/midtier/Apache/Apache/logs/access_log.%Y-%m-%d-%H_%M 86400 -300" common

Let me explain:

  • The format (%Y-%m-%d-%H_%M) will make sure that logfiles come out looking like access_log.2007-06-12-00-00 (when they roll over at midnight)
  • The 86400 part is how often to roll over to a new logfile, in seconds. 86400 is the number of seconds in a day, so this will cause logfiles to roll over once per day.
  • The -300 is how many minutes away from GMT the logfile will roll over. In this case, it will roll over 5 hours before 00:00 GMT (midnight GMT). For me, in Central time, that means that at least for part of the year, the logfiles should roll over at midnight. The downside of this approach is that it doesn’t automatically adjust for DST, so you’ll have to make the modification manually if it’s really important to you.

I also use the non-default parameter “UseWebCacheIp On” in the middle tier which makes the logfiles much more useful by putting the actual client IP address in the HTTP Server logfiles. Without this parameter, the HTTP Server logfiles are filled with the IP address of the webcache server (usually the same host as the HTTP Server).

That’s my rant about logfiles for Apache. I guess it’s the small things in life that really make me happy ;).

13 thoughts on “Oracle HTTP Server (Apache) rotatelogs configuration”

  1. I agree with our comment about the poor defaults and I like your prefered settings but you’ve attributed the defaults to the wrong source. I have a non-Oracle Apache installation and it has the same settings. My guess would be those are the Apache installation defaults and Oracle just never changed them.

  2. I haven’t done a vanilla Apache install for quite a long time–the last time I did an Apache installation, rotatelogs wasn’t used in the default configuration. Probably showing my age now 🙂

    Thanks for stopping by!

    Dan

  3. Hi, Can i rotate server.log file. If its possible can you please let me know how to implement that.

  4. For the server.log file from the OC4J, you would have to use ODL to do that. You'll find several notes on Metalink describing how to set up log rotation for OC4J and a few specially on using ODL (Oracle Diagnostic Logging) with OC4J as well. If you're thinking of a different server.log, then you'll have to clarify.

  5. Oracle's settings are sometimes weird. Everyone I know that uses Oracle has changed the settings. No one works with default. Not even the beginners.
    Sandra Millhouse | cheap virtual server

  6. hi ..

    wat is the parameter to be added to httpd.conf to archive the rotated logs ?

  7. The ErrorLog directive shown in the post is the actual parameter. Check your httpd.conf and you’ll see an ErrorLog directive. Replace it with something like what I’ve shown above if you’d like.

  8. Dan,

    Thanks for ur reply .. I also want to compress or gzip the rotated logs .. It will be great if u can help me on that …..

    Thanks Again !

Comments are closed.