Questions tagged [tail]
Output the last part of files.
95
questions
110
votes
10
answers
319k
views
How to display certain lines from a text file in Linux?
I guess everyone knows the useful Linux cmd line utilities head and tail. head allows you to print the first X lines of a file, tail does the same but prints the end of the file. What is a good ...
53
votes
12
answers
32k
views
Tail multiple remote files
Is there a way to remote tail 2 files?
I have two servers(a and b) behind a load balancer and I would like to do something like this if possible:
tail -f admin@serverA:~/mylogs/log admin@serverB:~/...
42
votes
4
answers
39k
views
In tail -f, how do I filter out stuff that has certain keywords?
I want to tail -f my logs. However, I want to filter out everything that has the words:
"ELB", "Pingdom", "Health"
40
votes
8
answers
33k
views
Colorize Monitoring of Logs
I sometimes monitor apache and php error logs using tail under FreeBSD. Is there any way to get colorized output, either using tail or some other command line app?
Alternatively, what is your ...
30
votes
10
answers
48k
views
Convenient Windows equivalent to tail -f logfile?
Is there some convenient alternative to this on Windows? I always miss this away from Linux. And no I don't consider Cygwin or some other bash port to be "convenient". :)
Either a small app that'll ...
24
votes
7
answers
15k
views
Continuously monitor logs with tail that are occasionally rotated
We're using tail to continuously monitor several logs, but when a log is rotated the tail for that file will cease.
As far as I understand, the problem is that when the log is rotated, there is a new ...
15
votes
4
answers
12k
views
`tail -f` sometimes stops updating - and the file hasn't moved
I have noticed recently that sometimes tail -f <logfile> will stop updating to the screen.
Doing a Ctrl>-C and restarting the tail works fine, though. And I checked to make sure the logfile ...
15
votes
2
answers
2k
views
Bash Prompt Below Output - Background Log Tail
I used to work for a company who had a customised shell for management of one of their products that was running on Linux and I'm looking to replicate a key feature of this shell.
All the work was ...
13
votes
4
answers
14k
views
How to watch for count of new lines in tail
I want to do something like this:
watch tail -f | wc -l
#=> 43
#=> 56
#=> 61
#=> 44
#=> ...
It counts new lines of tail each second
/ Linux, CentOs
To be more clear. I have got ...
12
votes
4
answers
9k
views
Is is possible to filter the output of tail?
I'd like to tail a file but only output lines that have a certain string in them. Is this possible?
10
votes
9
answers
19k
views
Colour tail of Apache logs
Monitoring apache logs with tail –f tends gets very frustrating for the eyes after a while. Are there any tool/options to colorize the log outputs? Maybe signal FATAL with red, etc...
10
votes
7
answers
8k
views
Tail -f on new files
Is there a way to do something like this:
tail -f logs/
and make the stdout to be updated on every line added to each file already present in logs/ and to every file that will be created in logs/ ...
9
votes
5
answers
1k
views
Adding tail behaviour where enter adds blank lines to less
I love less, which I can use to follow logs with the +F flag (or the ShiftF hotkey), search forwards and backwards, and generally move freely through the document.
But there is one thing missing in ...
9
votes
5
answers
6k
views
Is there a `tail -f` equivalent for when a file is overwritten (instead of appended to)?
How do continuously monitor a file that is being continuously overwritten? Specifically, the file contains a single line of text which a background process is repeatedly opening and re-writing.
I ...
8
votes
2
answers
2k
views
Tail server logs into XMPP?
So I have two files, and if a new line appears on either of these files, I'd like to receive an IM (preferably jabber or gTalk) containing the contents of that line. Do you guys have any suggestions ...
8
votes
2
answers
6k
views
Use local tools to monitor remote logs
I don't have root access on my hosted web server, but I would like to use tools like MultiTail to monitor log files that are generated on my web host.
Is there a way I can pipe the log output on my ...
8
votes
2
answers
7k
views
tail -f not following log file in Docker container
I am seeing some strange behavior running the tail -f command inside a Docker container in CoreOS.
There are a number of variables I can think of that may be contributing to the problem but I am not ...
7
votes
1
answer
972
views
screen causes "tail -F | grep" to echo unmatched lines
This is Ubuntu (3.13.0-29-generic #53), trying to do a simple bash script to monitor a log file for matching lines.
If I do the following, there is no output in the bash shell except for matches, ...
7
votes
1
answer
1k
views
How to get "tail -f" working on a file located on a Windows share
I'm using a Mac and I have mounted a Windows network disk in my file system using "Connect to Server" in the Finder.
In the terminal when i do tail -f on a log file located on said network disk, tail ...
6
votes
5
answers
8k
views
tail all log files in a directory | exclude zipped files
Im trying to find the right command to tail a bunch of log files whilst excluding the zipped files in a set directory. The log files are being zipped as they become oversized.
At the moment Im using:
...
6
votes
3
answers
15k
views
tail -f : `tail: logfile.log: file truncated`
I was watching a log file (logfile.log) with tail -f, and after a few minutes, the following message was written to the file:
tail: logfile.log: file truncated
I've never seen that before and I'm ...
6
votes
0
answers
3k
views
Log file rotation and "tail -f"
I use log4j to create rolling log files from my program. It writes to a log file until it reaches 256mb, and then it renames all the log files and creates a new log file and continues logging.
It is ...
5
votes
3
answers
3k
views
Can putty beep when tailing a log file?
I have a putty session tailing a log. I either keep flipping to it to see in anything has come up or I forget to check it at all. Can putty or tail be made to "beep" if anything scrolls into the ...
5
votes
2
answers
3k
views
tail -f without the tail?
Is there a command in Solaris to read a file, and when it gets to the end to stream the way tail does? I need to read the file from the start, and it is a binary file.
Information on Solaris and ...
5
votes
3
answers
10k
views
Tail a file from ssh and mirror to a local file
To tail a file over ssh, I can use
ssh -t remotebox "tail -f /var/log/remote.log"
However, it is possible to sync the tail with a local file? So a file automatically mirror the update of the tail ...
5
votes
3
answers
11k
views
tail: inotify cannot be used, reverting to polling: Too many open files
tail: inotify cannot be used, reverting to polling: Too many open files
I'm running apache and tomcat servers on Ubuntu (AWS ec2).
Whenever I try to tail the catalina.out of tomcat I get too many ...
5
votes
5
answers
9k
views
Can I tail an http resource?
Is there a way to tail a resource such as http://someserver.com/logs/server.log ?
This is what I would do for a local file.
tail -F /var/logs/somefile.log
I would like something similar to that for ...
4
votes
6
answers
8k
views
"watching" a log on FreeBSD vs Linux
On Linux systems I can
watch -n1 tail /var/log/whatever.log
or
watch -n1 grep somestuff /var/log/whatever.log
To show updates to a log every 1 seconds.
On FreeBSD however, the watch command does ...
4
votes
3
answers
14k
views
How to truncate the log file size without losing recent logs?
I want to reduce the log file size to the particular minimum size
I tried the truncate command as below
$ truncate -s 20M log filename
But when I check the truncated file it truncates the recent logs ...
4
votes
3
answers
2k
views
Monitor multiple Linux log files in real time
I'm debugging a Linux application that allows remote jobs to be submitted, logging the output from each job in a new file. The log file paths conform to:
/joblogs/job_*/JOB.LOG
where the wild card ...
3
votes
2
answers
9k
views
Tail, grep and count the instances found in one command?
I am tailing a files output and grepping for lines with certain data. I don't want to output the data to the screen but instead count the number of instances it found and send that to the screen. The ...
3
votes
4
answers
1k
views
Searching for a tail tool for Linux to colorize and suppress lines by regx?
Is there any tool that does both, colorize and filtering lines to suppress form output by regex?
3
votes
1
answer
2k
views
Continuously tailing a rotating log file with date and time in filename
I have a log file in format log_name_YY-MM-DD_HH_mm.log. The log rotates every couple of hours and the new log is created containing the date and time of it's creation. Sometimes I need to tail the ...
3
votes
2
answers
2k
views
Countinuous processing of tail -f output [closed]
I have a file where numbers are continuously appended:
1
2
3
4
I want to calculate their mean, also continuously, i.e.:
1
1.5
2
2,5
I don't want to check file periodically, I want to it in the ...
3
votes
1
answer
652
views
multitail/ssh leaves processes hanging around after exit
I'm using multitail via SSH to filter log output on a number of servers like so:
multitail -L "ssh foo.bar.com tail -n 0 -q -F /var/log/out.log | grep match"
This works great, however when ...
2
votes
4
answers
9k
views
Linux: Can I monitor all http connections to my site live? like tail -f /file/log.log only for http connections?
I want to monitor whether or not people are accessing my site live. I want to see the http connections made to my site in terminal/ssh. Something like a tail -f /file/log.log function but I believe ...
2
votes
2
answers
593
views
Bash edit file and keep last 500 lines
I am looking to create a cron job that opens a directory loops through all the logs i have created and deletes all lines but keep the last 500 for example.
I was thinking of something along the lines ...
2
votes
3
answers
6k
views
tail -f and then exit on matching string
I am trying to configure a startup script which will startup tomcat, monitor the catalina.out for the string "Server startup", and then run another process.
I have been trying various combinations of ...
2
votes
3
answers
256
views
Detect file update from modification time
Is there a way to see how often a file is being updated?
I mean I need to see if the modification time of a file is updated in a dynamic way (same as tail shows if the file is updated in a dynamic way)...
2
votes
1
answer
51
views
send file difference from redhat to windows
Is there a way to send file content difference from Redhat to a server listening on a specific IP/Port on Windows? I initially thought tail -f command but then comes the IP part, anyone can help me?
2
votes
3
answers
5k
views
How to make a cron script for cleaning up a log file? [closed]
I don't usually do this kind of stuff, so I just have to ask. How do I make a script which checks a log file, lets say it's named log.txt, grabs everything but the first 100 000 lines from it to a new ...
2
votes
3
answers
236
views
Search for a log pattern continuously
I am preparing a log watch dog but my concern is tailing always would blow up in some point. Thus,
My concern is to monitor the log file always and if a pattern match occurs.
Issue some commands on ...
2
votes
3
answers
168
views
issues to inspect a long text file in unix
If I run
sudo pico /var/log/lighttpd/website/error.log
I get a very long file, and I cannot see last lines. If I run:
sudo tail -f /var/log/lighttpd/website/error.log | awk '{print $1 "--" $2}'
I ...
2
votes
1
answer
395
views
tail command retry flag not working with wildcards?
I want to tail a bunch of unknown directories names containing a particular non-existant file, e.g.:
tail -F /tmp/*/app.log
However that does not work as intended with the wildcard: if I create a file ...
2
votes
2
answers
6k
views
find files and search for within tail
The following is working as expected.
find /opt/ -name "somefile.out" -exec grep 'Connection refused' {} \; | more
But if I want to search only in the tail of the found files, I can not add tail or ...
2
votes
1
answer
122
views
Tail log files on multiple servers
Scenario: I have load balanced servers running a web application. To debug I'd like to see the output of the same log file (such as the nginx log) combined into a single stream, e.g. a tail -f on all ...
2
votes
1
answer
11k
views
Cron is not running from docker container... failed
I am trying create cron a task in docker container. Everything are configured according to the @VonC 's answer
My dockerfile looks like this
FROM python:3.6.9
WORKDIR usr/src/mydir
COPY requirements....
2
votes
2
answers
790
views
"tail -f" style web application
I've been searching for a small but functional PHP script or similar that I can expose via apache. Basically I'd like what "tail -f /var/log/something" does, but visible via a web browser. I'm finding ...
2
votes
1
answer
578
views
Any way that I can feed tshark a live capture written to a file without reading from the start?
I'm capturing traffic from a microtik router to my linux server and writing to a big file. I'm searching for a way to feed from the current file end forward since it is a several GB file and I can't ...
2
votes
3
answers
3k
views
Best tools for "ssh tail -f" style log file monitoring and analysis [closed]
I'm looking for a tool to monitor custom PHP Error logs/Apache and possibly Java logs on remote development servers.
I'm not looking for a full production log system like Splunk, but something that's ...