SUMMARY: weird file issue - apache logs following moved file

From: Iain Miller <iainonthemove_at_gmail.com>
Date: Mon Dec 05 2005 - 11:53:18 EST
Original Mail

> Hi Guys,
>
> Very strange one here and I am hoping that someone can shed some light.
>
> We are running apache 1.3.33 on Solaris 8 on an old legacy box here.
> One of our access log files is getting a bit big so I planned on
> moving it to a temp file (access.temp) and then compressing the moved
> file in case anyone ever needed access to the data contained therein.
>
> However when I move the file, apache still logs to the newly moved
> file (access.temp).  I expected that it would either recreate the
> original log file (access) or barf that it didn't exist and I'd have
> to manually touch it.
>
> It's very repeatable, but I am at a loss to describe it.  I don't
> really want to stop apache and then move the file as it's an important
> box.
>
> Thanks in advance,
>
> I will summarise.
>
> Iain.
>

Many Thanks to everyone who replied (about 40 in total).

The root cause was that apache writes to a file descriptor (inode) and
this is not moved with the mv command.

Various solutions were put forward to resolve this.

1.  copy the file to somewhere else (access.temp) and then cp
/dev/null to the file
2. use the inbuilt apache log rotate ability to prevent log files
getting too big
3. mv the file and then send a HUP to the apache proc
4. mv the file and then restart apache using the graceful command.

Again many thanks to all who replied.

Best Regards,

Iain.



--
Iain Miller
iainonthemove@gmail.com
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Mon Dec 5 11:53:44 2005

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:53 EST