LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-29-2011, 05:21 AM   #1
Fracker
Member
 
Registered: Mar 2009
Posts: 90

Rep: Reputation: 0
tail new file


We have a process which generate logs, when log size reaches to a size limit, it start generating a new file.

Some operators are meant to monitor these logs continuously. We are using created a menu for operators to tail -f which display logs on the screen. But the problem is, after some time tail -f stops since log file changes. and operator needs to relogin to change the logs. Is their any way, which automatically change the log file, when it don't update for some time.
 
Old 11-29-2011, 05:49 AM   #2
_bsd
Member
 
Registered: Jan 2010
Location: Velveeta, USA
Distribution: Xen, Gentoo,Ubuntu,openSUSE,Debian,pfSense
Posts: 98

Rep: Reputation: 9
Code:
eg: tail --follow=name /path/file2follow
when the file gets moved/archived tail will follow the new file

you'll see a message similar to the following

$ tail --follow=name foo
data line1
data line2
data line3
data line4
data line5
tail: foo: No such file or directory
tail: `foo' has appeared; following end of new file
data line6
...
 
Old 11-30-2011, 07:23 AM   #3
Fracker
Member
 
Registered: Mar 2009
Posts: 90

Original Poster
Rep: Reputation: 0
But here file don't get renamed but new file generates with new name. we normally use ls -ltr | tail -n 1
 
Old 11-30-2011, 08:11 AM   #4
_bsd
Member
 
Registered: Jan 2010
Location: Velveeta, USA
Distribution: Xen, Gentoo,Ubuntu,openSUSE,Debian,pfSense
Posts: 98

Rep: Reputation: 9
have file moved, compressed. new file created, symlink to file.
look in /var/log, see how logs are moved, compressed.

If you can either keep same name or use a symlink, the command I gave you will work
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tail the last line of a file Pinglu Linux - Newbie 14 11-17-2011 09:09 AM
tail file if the name is changeable m1n Linux - Newbie 7 01-01-2010 07:09 AM
Cannot use tail -f to monitor log file v0nd00 Ubuntu 7 12-11-2009 02:05 AM
tail file over tcp lloydie-t Linux - Networking 5 05-15-2007 02:18 AM
perl File::Tail hell whysyn Programming 2 03-14-2007 02:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration