Questions tagged [tail]

Watching updates at the end of a file, with or without the tail utility

32 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
145 views

Tailing file using less +F/shift-F, turn off line buffering?

When using tail -f, it prints each character as it is written to the file, but less +F won't print until it sees a linefeed. And if the data being written to the file does not contain linefeeds, must ...
3
votes
0answers
80 views

Why does 'tail -c 10K' cause it to read an entire 16GB flash drive?

To view the last 10K of a 128GB internal SSD I used: sudo tail -c 10K /dev/sda | xxd This worked as expected and immediately output the data. However when I try to view the last 10K of a 16GB USB ...
2
votes
1answer
922 views

tail: error writing 'standard output': Broken pipe

I tried to use some scripts which use tail commands on Debian stretch but I got tail: error writing 'standard output': Broken pipe. Does Debian handle tail and pipe syntax differently? Thank you in ...
1
vote
0answers
32 views

Inconsistent behaviour when piping output of Tail into Xargs through an editing command

I'm giving in to asking the SE spirits for assistance. I will expand in detail below, but I've boiled the inconsistency down to these 3 lines. I am trying to grep a string in between single quotes (...
1
vote
0answers
14 views

want to live monitor all log files in one vieuw

I like to view all log files live like tail -n0 somelog.log But then for literally all log files on the system (CentOS 7) Or an other way to do this is also nice. I want to output this to a web page ...
1
vote
0answers
50 views

Grep something that is between two known strings

I have a large potentially zipped log file and I can identify which line number some text I'm interested in is on using: find . -name "*" -exec zgrep -C 1 -n -i -H TextToFind {} \; But in a second ...
1
vote
0answers
81 views

how to mimic “tail -f … | grep …” using less?

When using tail -f some/filename, it waits for more to be appended to the file. Just like less +F .... However if I have a pipeline such as tail -f some/filename | ... then the less +F ... | ... does ...
1
vote
0answers
50 views

tail reopen file when directory changes

I've got a symlink pointing to the "latest" directory, and I want to tail a file in the latest directory, even if the symlink changes to a newly created directory. I often use tail -F for files and ...
1
vote
0answers
587 views

How to tail and grep log file, combine into a single line and pass as argument to another command

Using the following command, I managed to fetch error messages below (it's 3 lines). $ tail -f -n 0 error.log | grep -A2 --line-buffered "Internal server error" ! @79884flo2 - Internal server ...
1
vote
0answers
90 views

Following a Virtual File?

I'm writing a kernel module to collect some data and printing it out to a file in /sys. I know these files are virtual files, and my understanding is that they are essentially generated every time you ...
1
vote
1answer
268 views

Use tail and grep to send an IRC message?

How do I use a command like: tail -f /home/user/log.txt | grep '!calladmin\|admin' To send an IRC message to me when !calladmin or admin are posted in the log? Or is there an easier way to do this?...
1
vote
1answer
915 views

Get last changed content since last read

How can I get the last changed content of a file, since its last read? Something more precise that this: tail - <nr >file_1.txt >file_2.txt where file_2.txt gets the last modified content.
0
votes
0answers
35 views

How do I 'tail -f' to a file, while also executing a script utilising that file indefinitely?

I am so close to getting it, but fear I have spent too long looking at this and am getting lost as to how to accomplish what I want. What I am trying to do: Take the access log from my server, parse ...
0
votes
1answer
23 views

Any way to tell where log output is coming from?

On a unix system, I have a file in /logs which is being written to constantly by multiple sources. Is there a way, maybe with tail(?), to determine what processes are writing to this output?
0
votes
0answers
20 views

given `logger -t specificUser` how do filter tail by that tag? (tail -f ??? specificUser)

if i'm tagging my logs with -t, how do i filter my log searches for that specific tag? given: logger -t specificUser show it (in real time) with tail -f ???? specificUser
0
votes
0answers
25 views

Log recording with tail -f

Is there any function in linux's tail utility that lets use save a recording. The scenario is: At current line in log, start recording Do operation that can generate logs, or many logs Stop and save ...
0
votes
0answers
39 views

Execute an action if a log file contains a text

i have a question about executing a command if a certain text is in a log file. There is already the article: https://unix.stackexchange.com/questions/12075/best-way-to-follow-a-log-and-execute-a-...
0
votes
0answers
45 views

How to tail running log and grep or awk multiple strings in sequence then terminate

I am facing an issue to use shell script restart server and confirm it restart success immediately after observing multiple strings in sequence, the case is i have to monitor a running log, as example ...
0
votes
1answer
189 views

Extract last lines of a logfile by time

tail -n 100 myfile.log gives my the last 100 lines of myfile.log. Is there an existing tool that expects the first "column" of each line in a file as a timestamp and can give me the n last hours/...
0
votes
0answers
29 views

Monitor Apache Selectively

I am working to parse apache logs in Common Format in realtime so that I monitor them while I work. "tail -F /var/log/apache2/access.log" works but provides more than I need. "awk '{print $1 " " $2 " "...
0
votes
1answer
1k views

How to write Docker logs to a file in real time (à la `tail -f`)

I docker that output logs stdout stderr, which can be viewed using: docker logs -f $LOGS_CONTAINER_ID I also added 'sed', which puts the container id on each line: docker logs -f $LOGS_CONTAINER_ID ...
0
votes
1answer
1k views

tail not working on mac terminal

Due to my lack of experience with script language, (shame for a Mac user) I have referred to several sources: link seemed resolved with ls *.extension | xargs -n 1 tail -n +2 This didn't for me, ...
0
votes
1answer
49 views

Too many emails sent when sending emails when specific URL has been visited in Apache Logs

In this question, a solution was found to automatically send an email each time a specific URL is visited (such as ?src=foo), as seen in the Apache logs: tail -F -n0 /var/log/apache2/...
0
votes
1answer
66 views

Create a listing of every user which owns a file in a given directory as well as how many files and directories they own

I am having trouble understanding the code : ls -l /projects/ghosttrail | tail -n +2 | sed 's/\s\s*/ /g' | cut -d ' ' -f 3 | sort | uniq -c. Can anybody give me a detailed explanation of what is ...
0
votes
0answers
168 views

What is the fastest command to trim the header of a csv file?

I need to trim the header in a csv file. I have used tail -n +2 ... which works fine but it is really slow (I have lots of 100M files), and I don't understand why since no memory is needed from tail ...
0
votes
1answer
508 views

Showing color in log output using tail command when using Cygwin?

I have a debian install that runs an application server. I ssh into this debian install from a Windows computer using cygwin and with the application server running I use tail -f to monitor the log ...
0
votes
1answer
1k views

live tail (tail -f) of file being grepped

i can do tail -f -n20 <file> to see the last 20 lines of the file, live. If i want to grep something, tail -f <file> | grep <pattern>, it will still be live, but will only grep ...
0
votes
1answer
238 views

Head and Tail of a directory, set by the user

I have this script that will show the user the head or tail of the files that are inside a set directory (currently that is set as '~/bin/new/*'). This script works but i would like to allow the user ...
0
votes
1answer
354 views

Need to grep for specific lines from ongoing log and save it in some file

There is just one log, which will have info on certain devices, that i am upgrading. I use "tailf log" to monitor the log. Now, say, I am upgrading 10 devices, the log will go on populating lines ...
0
votes
1answer
126 views

Linux FIFO buffering depends on invocation order of readers and writers

I'm trying to write a simple python script that reads from a fifo and then writes to another fifo. I have created two FIFOs using the following command: $ mkfifo input $ mkfifo output I invoke the ...
-1
votes
1answer
66 views

How to use END {} in awk when there is no end to the input?

Say I'm using a command like tail -f ./somefile as input into my awk command. And I want to continually sum a count of matches using awk, almost like running a | wc -l at the end of a command, but ...
-7
votes
1answer
6k views

Head and tail command

How can i do this exercise in unix? Create the following command: lshead.bash – list the first few lines of every file in a directory specified by the argument. This command should also allow options ...