.comment-link {margin-left:.6em;}

IntTech

Monday, December 01, 2008

Using cronolog with mod_jk

The trick to rotating mod_jk logs using cronolog is an old unix file system feature called a named pipe.

Create a pipe in a good location.
> mkfifo mod_jk.pipe

Specify this pipe as log location using JkLogFile directive.
JkLogFile path-to/mod_jk.pipe

The next part is tricky. You have to get cronolog to read from the pipe and the timing can be a challenge. Each side will block until something is both writing and reading from the pipe. So you need cronolog reading from the pipe before you start apache.

Interestingly, on my latest project mod_jk did something at start up that caused cronolog to exit as soon as apache started. To get things to work I had to start cronolog after apache. The solution was to have the following steps in the apache start up script.

1. Start cronolog
2. Start apache
3. Start cronolog again.

Using the file name examples above, starting cronolog looks like this:
cronolog path-to/mod_jk.log < path-to/mod_jk.pipe

Labels:

Bookmark and Share

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home


Google