How to get the appended data?

Posted on 2003-03-06
Medium Priority
Last Modified: 2010-04-20
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.
Question by:redhat_786
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 20

Expert Comment

ID: 8088121
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

Accepted Solution

alain_tesio earned 160 total points
ID: 8145991
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 :

Expert Comment

ID: 9087773
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 
Post your closing recommendations!  No comment means you don't care.

Expert Comment

ID: 9287710
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.


EE Cleanup Volunteer

Featured Post

TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question