How to get the appended data?

Is there any way to get the appended data only and to save it in another file except using tail -f. I want to make that file empty after 24 hours so that the space is saved on the disk. I want to run it as a background job and let it run for a day to extract only the appended online incoming data into a file say fname1. Then I will process that fname1 and make that empty and the command will continue to run as a background job. I can't use kill command as my boss doesn't allow it to run it on server. Thanx for your cool help in advance.
redhat_786Asked:
Who is Participating?
 
alain_tesioConnect With a Mentor Commented:
Look at logtail which is a part of logcheck, it remembers the offset of lines read in each file.
The site I had seems to be down, the source code is in the debian archive :
http://ftp.debian.org/debian/pool/main/l/logcheck/logcheck_1.2.11.tar.gz
0
 
GnsCommented:
Why except "tail -f" from viable solutions?
tail -f fname1>fname2
will "save" the "last part" of fname1 into fname2.
just break the tail whenever you feel the need to postprocess the log-snippet in fname2, remove it or ... whatever...
Of course you could script this fairly easily.

If you just need to inspect the "last day or so" off log data visually, then "less -e fname1<Enter>F" will do an equivalent to tail -f, while providing good pagination.

There are other silly things you might do, but why bother?

-- Glenn
0
 
CleanupPingCommented:
redhat_786:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
TheWeakestLinkCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept comments from alain_tesio as answer
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheWeakestLink
EE Cleanup Volunteer
0
All Courses

From novice to tech pro — start learning today.