0

I have this issue with my lighttpd installation where logging to access.log will cease once the default log-rotating software erases my access.log after copying it to access.log-YYYYMMDD. I have to stop and restart the service to get the logging to continue.

Here's the uname and centos-release info for the dedi this is happening on:

np ~ > uname -a && cat /etc/centos-release
Linux sevlet 3.10.0-123.20.1.el7.x86_64 #1 SMP Thu Jan 29 18:05:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
CentOS Linux release 7.0.1406 (Core)

I have no idea what log-rotation software comes pre-installed on this box, and I have no idea why lighttpd completely stops writing to access.log once the file gets rotated out. Anyone have any idea what's going on and/or how to fix it?

Solved!

Anyone having this problem or a similar one on a minimal CentOS 7 install, please read:

@chutz suggested I take a look at the lighttpd configuration in /etc/logrotate.d/. The default configuration for lighttpd works, but it calls killall to restart the daemon. A minimal install of CentOS 7 doesn't include killall.

To install on CentOS:

yum -y install psmisc

Hope this helps someone!

  • Please don't answer your question in the question. In stead create an answer to your own question. – Reaces Mar 06 '15 at 06:41

1 Answers1

1

CentOS comes with logrotate.

You do need to restart or otherwise signal any demons after moving their log files. That's how Linux works. The file may be renamed or deleted, but as long as a process has it open (i.e. a process has a file handle open which is independent of the file name), that process can continue writing to it. Yes, it is possible to continue writing to a deleted file, and sometime it may even be possible to recover a deleted file as long as someone still has it open.

Check /etc/logrotate.d for examples on how to reload a process after log rotation.

P.S. I did not notice that you are running CentOS 7. My answer may be very wrong.

chutz
  • 7,569
  • 1
  • 28
  • 57
  • Your answer is probably right, but it's strange, because my `lighttpd` file under `logrotate.d` seems to do what it should do to make this work. See here: http://pastie.org/pastes/10003737/text – Nickolas Peter O'Malley Mar 06 '15 at 01:18
  • Haha I'm foolish, I figured out why the `logrotate` settings for `lighttpd` aren't working. It's a minimal install, so `killall` isn't installed. Checking `logrotate.d` indirectly solved the problem, so thanks. :P – Nickolas Peter O'Malley Mar 06 '15 at 01:20