On 02/23/2010 04:30 AM, Tsantilas Christos wrote: >> Log rotation will probably need special care to avoid rotating the same >> log many times. It is relatively easy to designate one process to do the >> rotation (e.g., squid1), but that alone is not enough to synchronize >> everything. Ideally, I would prefer to avoid locking. Any clever tricks >> applicable here? > > Maybe something like the following: > - there is a master process > - master process communicates with one direction pipes with kids, sending > various commands
Let's separate IPC mechanism from log rotation. It is clear that we need some IPC mechanism but log rotation itself should not depend on the IPC mechanism choice. > For logs rotation: > - master process closes the old file and rename it > - master process opens a new log file > - kids still writing to the old file (because they did not close the > file descriptor yet) > - master process send a command to all kids saying that the log file > rotated > - The kids close the log file and reopen it. I think the above log rotation scheme is what we should start with. The "master" process will be either the process receiving the log rotation signal or the process receiving the "initiate" log rotation command via some other IPC mechanism. Thank you, Alex.
