Reputation: 2654
I need to monitor the access.log of a website. I can use the unix tail -f
in my php but the problem is that when the http server is restarted, the file is truncated and the read stops.
I need this feature in php.
Upvotes: 1
Views: 1069
Reputation: 396
try using tail -F not -f -- this way it'll continue to monitor the file even if the file is truncated or deleted. it's not the best way though but saves the day.
Upvotes: 1
Reputation: 96159
Haven't tried it, but maybe Inotify can help you:
inotify is a Linux kernel subsystem that acts to extend filesystems to notice changes to the filesystem, and report those changes to applications.
There's a php extension for inotify, see http://docs.php.net/manual/en/book.inotify.php
Upvotes: 2