Re: [SLUG] tail and rotated log files
Yo. Tony Sceats wrote: sounds like you want tail -F log or tail --follow=name --retry log Thanks Michael and Tony. I did some tinkering with the -F option yesterday and, yeah, looks like that one does the trick. Guess I misread the man page never used the max-unchanged-stats argument though - maybe it's used to delay the retry? wtf is an iteration in tail anyway? 5 poll's on the file?! Yeah, it seems to poll the file for changes at a fixed interval? max-unchanged-stats ties in with the --sleep-interval argument, in ways that don't seem terribly clear cut. -- Pete -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
[SLUG] tail and rotated log files
I have a script that uses `tail -f --max-unchanged-stats=5` to follow a log file. The way I read the man page, --max-unchanged-stats will cause tail to close and reopen the given file if it hasn't changed after 5 iterations. But after logrotate rotates the logfile, tail keeps watching the old file, and doesn't seem to open the new one. So: - Am I missing something here? The man page doesn't mention any, but is there I signal I can throw tail that'll make it reopen its file? - Is there a better way, short of application-specific trickery, to keep an eye on a log file? I'm considering having syslog log to a named pipe as well and have my script read from that. But I'd like to hear other suggestions for feeding a shell script from a system log. -- Pete -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] tail and rotated log files
Peter Hardy [EMAIL PROTECTED] writes: I have a script that uses `tail -f --max-unchanged-stats=5` to follow a log file. The way I read the man page, --max-unchanged-stats will cause tail to close and reopen the given file if it hasn't changed after 5 iterations. But after logrotate rotates the logfile, tail keeps watching the old file, and doesn't seem to open the new one. So: - Am I missing something here? The man page doesn't mention any, but is there I signal I can throw tail that'll make it reopen its file? - Is there a better way, short of application-specific trickery, to keep an eye on a log file? I'm considering having syslog log to a named pipe as well and have my script read from that. But I'd like to hear other suggestions for feeding a shell script from a system log. According to my man page, you want -F or --follow=name --retry -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] tail and rotated log files
Hey Peter, sounds like you want tail -F log or tail --follow=name --retry log never used the max-unchanged-stats argument though - maybe it's used to delay the retry? wtf is an iteration in tail anyway? 5 poll's on the file?! On 1/15/07, Peter Hardy [EMAIL PROTECTED] wrote: I have a script that uses `tail -f --max-unchanged-stats=5` to follow a log file. The way I read the man page, --max-unchanged-stats will cause tail to close and reopen the given file if it hasn't changed after 5 iterations. But after logrotate rotates the logfile, tail keeps watching the old file, and doesn't seem to open the new one. So: - Am I missing something here? The man page doesn't mention any, but is there I signal I can throw tail that'll make it reopen its file? - Is there a better way, short of application-specific trickery, to keep an eye on a log file? I'm considering having syslog log to a named pipe as well and have my script read from that. But I'd like to hear other suggestions for feeding a shell script from a system log. -- Pete -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html