Questions tagged [tail]

Output the last part of files.

Filter by
Sorted by
Tagged with
0 votes
0 answers
24 views

Stream output split between tail and underlying file

I was tailing a log file overnight, which is written to by a docker container that mounts a file under /var/log on the host. What I found this morning is log lines are randomly in only either tail's ...
whoasked's user avatar
  • 269
2 votes
3 answers
5k 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 ...
jayaprakash R's user avatar
0 votes
1 answer
430 views

Why tail to same file create a empty file, or empty the file? [duplicate]

I try to maintain the last lines of a file, but when tail -n 10 test.txt > test.txt create or empty the file... SO: Ubuntu server Example: #test.txt file 20 May 23 12:24 test.txt a a a a a a ...
DarckBlezzer's user avatar
0 votes
2 answers
324 views

I want to exclude specific words from the results when piping tail into grep

I am using "tail -f /var/log/fail2ban.log -f /var/log/ufw.log | grep -e Ban -e BLOCK -e ALLOW" (without the quotes) and it is working but I want to exclude the results that have the words ...
Greg Azar's user avatar
0 votes
0 answers
623 views

Delay in NFS Client file Updation in NFS Server

We have an NFS server and our custom board which is our NFS Client. We are generating a log file as part of our custom application. This log file is getting generated in the root file system of the ...
Aparna's user avatar
  • 1
0 votes
1 answer
54 views

Linux cli pipeline command tail and grep

I am using tail to monitor a log file and using grep to filer the keyword. tail -F somefile.log | grep "keyword" is working tail -F somefile.log | awk '{print $4}' is working but if to put ...
olo's user avatar
  • 103
2 votes
1 answer
310 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 ...
iomv's user avatar
  • 123
1 vote
1 answer
349 views

tail -F still stops on logrotate sometimes

Linux ip-10-10-64-122 4.1.7-15.23.amzn1.x86_64 #1 SMP Mon Sep 14 23:20:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux I'm using tail -F in a bash script which in turn loops over the results. This script ...
pstanton's user avatar
  • 623
2 votes
1 answer
8k 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....
Shokan Iliyas's user avatar
0 votes
1 answer
537 views

How to tail server.log and grep multiple text combination? [closed]

The server log is too large, I would like to grep the logs which has "/API/login" and "/API/init" from the server log. I'm able to use: tail -f /server.log | grep -i "/API/...
Tech's user avatar
  • 3
1 vote
2 answers
982 views

Systemd starts unknown openvpn instances - how could I disable this?

this is my output by tail -f /var/log/syslog/. May 26 08:02:29 ovpn-server systemd[1]: openvpn-server@ovpn-42.service: Main process exited, code=exited, status=1/FAILURE May 26 08:02:29 ovpn-server ...
ikreb's user avatar
  • 113
1 vote
0 answers
4k views

Convert json file to prometheus metrics

I have nginx json access log like this, a file that append sample like this to end of file. { "time": "2019-11-27T08:23:39+00:00", "msec": 1574843019.787, "ip": "91.133.248.69", "agent_name": ...
sweb's user avatar
  • 461
1 vote
0 answers
376 views

SSH session terminates while tail -f running

For the past year or so, I have found that if I leave a 'tail -f' command running in my terminals for more than a few minutes, the SSH session will disconnect. Before the disconnection occurs, the ...
John Rix's user avatar
  • 133
0 votes
2 answers
737 views

redirect tail output to a remote serever

I want to tail -f a local file, for example app1.log, and send its output to a file on a remote server. tail -f app1.log >> <remote server>:/home/remote.log Is this doable?
Luke Devon's user avatar
0 votes
2 answers
150 views

Count instances of a pattern's match in a real-time log file, in a specific time frame, using PowerShell?

I've to intercept a pattern in a log file and, when this pattern is matched for 5 times in 5 minutes, send an alert... I've wrote this lines, but I'm stuck... I don't know how to handle the time ...
ilRobby's user avatar
0 votes
1 answer
32 views

Pass output from the tail to the background script while still displaying data

I have a server and a local PC. When the local PC boots up, I run the following script to display the output from the server logs locally on the PC. /usr/bin/ssh -p '444' 'user@remoteserver' "tail -f ...
0x29a's user avatar
  • 135
2 votes
1 answer
50 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?
maxjoy's user avatar
  • 23
1 vote
2 answers
453 views

sed removing line breaks tail

In my Python script I needed a fast/efficient way to set a max filesize on a file I'm constantly writing to. Rather than bring the whole thing into py's RAM, I ran this shell command: sed -i '1d' ...
xendi's user avatar
  • 414
1 vote
1 answer
242 views

Tail a massive log file in Windows

Inherited an IIS server when I started a new job. The previous "admin" had no log management policy in place. I'm now staring at a 56GB .log file that was created by a piece of software running in the ...
UnS3eN's user avatar
  • 61
1 vote
2 answers
176 views

Console File Color

Asterisk is generating a log file with following content: #033[1;31mWARNING#033[0m[10505]:#033[1;37mres_phoneprov.c#033[0m:#033[1;37m1232#033[0m #033[1;37mget_defaults#033[0m: #033[1;31mERROR#033[0m[...
Ilie Soltanici's user avatar
0 votes
0 answers
893 views

Use `tail` to rotate nginx logs in order have a single log file capped in size

Can use tail to rotate a nginx log file in orderer to have a single log file capped in size? tail -c 1000000 access.log > temp.log mv temp.log access.log kill -USR1 `cat /var/run/nginx.pid` The ...
Paolo's user avatar
  • 149
1 vote
1 answer
232 views

Tail application for windows that will track a file across newly created folders

I am working with a product, that every time its windows service is restarted, it creates a new folder with date and timestamp, and starts logging into files in this folder. I am looking for a tail ...
LarsWA's user avatar
  • 151
2 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 ...
CyberMuz's user avatar
  • 325
0 votes
1 answer
121 views

Is there a way to monitor file access

I need a way to monitor the moment a file is accessed. Something similar to Tail (but for windows). The file that is being accessed is not a text file but a binary (*.wav) file. While it would help if ...
Eminem's user avatar
  • 103
1 vote
0 answers
108 views

Grep error or limitation reached on 1.2GB text file?

grep on large file followed by tail produces incorrect result, see proof below. The file is 1.2GB large, but grep should process it as a stream, so where could be a problem? root@condor1796 /home/...
Mladen Adamovic's user avatar
1 vote
1 answer
462 views

Using tail -F for monitoring huge file

I came across a requirement where I need to continuously monitor a live (appending) file for a predefined pattern (say a error message), I'm planning to use tail -F [FileName] | grep "pattern" & ...
vasco.debian's user avatar
0 votes
1 answer
96 views

Continuously save tail of standard input

I have a program that generates large logs on the standard output. Actually I don't care about the log, but I do want to know the last 1000 lines or so if the program finishes or crashes. I want ...
steve00's user avatar
1 vote
1 answer
260 views

Can I filter output from `tail` with the `-f` flag?

I'd like to tail -f the output of access_log on RHEL 6.8 but pipe and grep that output to act as a filter. Is there such an option? That is I'd like live output from: # tail -f error_log | grep <...
Rick's user avatar
  • 299
2 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 ...
user53029's user avatar
  • 629
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 ...
Guy395's user avatar
  • 21
2 votes
2 answers
424 views

Script to email if grep result is null

its been a long time and I cant seem to remember how to do this. I am trying to grep a logfile for a word or words and email if it does not exist in the last fifteen minutes ( I will be setting a cron ...
Brian's user avatar
  • 21
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 ...
jmreicha's user avatar
  • 790
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: ...
JackalopeZero's user avatar
0 votes
2 answers
98 views

Tail grep what tools are for it

I would like to run the following command: tail -f /var/log/syslog | grep -ri 00:16:CB:1E:AF:CA In Linux but it does not working. How would you interactively grep certain text from log files?
naturelle's user avatar
-2 votes
1 answer
124 views

Omit certain lines from tail -f [closed]

I like tail -f but I like to omit lines that have a certain string in them. Is this possible? I have seen example to include certain string but not how to omit.
user2548919's user avatar
7 votes
1 answer
936 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, ...
Dale Mahalko's user avatar
0 votes
1 answer
65 views

unknown client in my error.log

I have recently reinstalled my VPS OS and at present do not have any websites in my public_folder. In order to investigate a dovecot error which of course is not my question here, I issued tail -n 20 ...
developer's user avatar
  • 545
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 ...
Howard's user avatar
  • 2,105
0 votes
3 answers
219 views

tail -f AND allow text input

I want to create a script that allows some interactivity by tail -f logfile from myService allows text to be entered and sent to myService What I could not solve yet is this two functions working ...
Lorinc Nyitrai's user avatar
1 vote
3 answers
6k views

Capture piped multiline grep output into a variable

I'm using Zabbix's zabbix_sender.sh script to push exception stack traces to my remote Zabbix monitoring server. zabbix_sender.sh requires a key and a value for any data that it sends. It can read ...
skyler's user avatar
  • 465
0 votes
0 answers
598 views

Automatically reconnect ssh session for tailing remote file

I need a solution that basically tails a log file from a remote box... Works on Mac Restores itself whenever I have internet. (I frequently close and open the lid of my macbook) It could be a ...
blak3r's user avatar
  • 731
2 votes
1 answer
564 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 ...
Kostas Papadimakis's user avatar
1 vote
1 answer
3k views

tail command not updating output for debug files

I know that tail -f /var/log/messages will be keep updating on screen as the contents of file gets updated. But when I tried the same thing with a debug file system's file it is not working , any idea?...
kumar's user avatar
  • 423
9 votes
6 answers
7k 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/ ...
Jack's user avatar
  • 515
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 ...
iamacarpet's user avatar
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 ...
user23577's user avatar
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 ...
blueFast's user avatar
  • 4,170
5 votes
5 answers
8k 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 ...
Rythmic's user avatar
  • 151
1 vote
3 answers
2k views

tail-pipe-awk script, fine on Centos but weird on Ubuntu

I wrote a script on CentOS and now I'm trying to run it on Ubuntu and it is behaving unexpectedly. Here's something like the script, which I run under bash: sudo tail -F /var/opt/my-application/log/...
jg3's user avatar
  • 169
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 ...
Jörgen Lundberg's user avatar