tail

How to spawn another process and capture output in python?

徘徊边缘 提交于 2019-12-10 16:14:51
问题 I'm just learning Python but have about 16 years experience with PERL and PHP. I'm trying to get the output of ngrep and write it to a log file using Python while also tailing the log file. I've seen some examples online but some seem old and outdated and others use shell=True which is discouraged. In perl I just use something similar to the following #!/usr/bin/perl open(NGFH,"ngrep -iW byline $filter"); while ($line = <NGFH>) { open(LOG,">> /path/to/file.log") // highlighting, filtering,

bash tail on a live log file, counting uniq lines with same date/time

余生颓废 提交于 2019-12-10 14:58:16
问题 I'm looking for a good way to tail on a live log file, and display number of lines with the same date/time. Currently this is working: tail -F /var/logs/request.log | [cut the date-time] | uniq -c BUT the performance is not good enough. There is a delay of more than one minute, and it output in bulks of few lines each time. Any idea? 回答1: Your problem is most likely related to buffering in your system, not anything intrinsically wrong with your line of code. I was able to create a test

Tail multiple files in CentOS

 ̄綄美尐妖づ 提交于 2019-12-10 13:43:52
问题 I want to tail multiple files (and follow them) in CentOS, I've tried this: tail -f file1 file2 file3 but the output is very unfriendly I've also had a look at multitail but can't find a CentOS version. What other choices do I have? 回答1: Multitail is available for CentOS in rpmforge repos. To add rpmforge repository check the documentation on 3rd Party Repositories. 回答2: I found the solution described here work well on centos: The link is http://www.thegeekstuff.com/2009/09/multitail-to-view

Unix to tail solution for waiting for a specific string or quitting after a timeout

血红的双手。 提交于 2019-12-10 10:54:26
问题 I am trying to improve a service (daemon) script to display tomcat output (when run from a tty) until the application is effectively started. Tomcat apps can take up to 10 minutes to start and it's extremely useful to see what happens. Still, we need to be sure that this startup script will not run indefinitely if the startup confirmation message is failing to appear in the logs. I know that the internet is full of similar questions, but so far I wasn't able to identify a clear solution,

How to keep log tail alive on Heroku using ssh?

泪湿孤枕 提交于 2019-12-09 12:26:24
问题 Using heroku logs --tail which works great for a few minutes. Then it stops displaying the logs. It seems that the ssh connection is timing out and dying. There is no error or message. Working in Ubuntu 11.04 on wired conneciton. I added the following to ~/.ssh/config: ServerAliveInterval 5 But it didn't work. Do I need anything else in the config file? How do I know if it is doing anything? How can I monitor the traffic and see the keepalive request? I am looking at System Monitor but don't

tail multiple files and grep the output [closed]

北慕城南 提交于 2019-12-09 08:44:01
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I would like to grep a pattern from multiple log files which are being constantly updated by some processes and tail the output of this grep continuosly. Below command doesnt work and I get tail: warning: following standard input indefinitely is ineffective tail -f | grep --line-buffered "Search this: " /var

Apply formatting to unix shell

こ雲淡風輕ζ 提交于 2019-12-09 04:24:45
问题 I've been looking at some server logs using tail -f recently, and have thought that it'd be much easier to see some things if I could format the output. Really all I'm looking for is a way to perhaps colour certain words (determined by a regex), and perhaps remove certain words (again, determined by a regex). I know there's programs which visualize server logs in real time and whatnot, but I'm more interested in this. 回答1: Pipe the output of tail -f into sed , and add in some ANSI escape

PHP built-in server error log location

与世无争的帅哥 提交于 2019-12-09 02:20:04
问题 I don't know if there's any? but is php built in web server also save its error logs in a file? for tailing purposes, like when creating virtual host in apache. UPDATE: i'm using mac osx 回答1: The built-in webserver doesn't log anywhere by default, so you need to provide a php.ini for it to customise this. For example, if you created a file called php.ini with this content: error_log = /Users/me/test.log log_errors = on date.timezone = UTC Then you can start PHP's built-in webserver like this:

unix command 'tail' lost option '--line-buffered'

懵懂的女人 提交于 2019-12-08 11:06:32
问题 With the last update of our SuSE Enterprise Linux 11 (now bash 3.2.51(1)-release), the command "tail" seems to have lost its option to stream files: tail: unrecognized option '--line-buffered' Our tail is from "GNU coreutils 8.12, March 2013". Is there another, equivalent solution? 回答1: As far as can be told by simple googling, tail doesn't appear to have a --line-buffered option, grep does. --line-buffered is useful to force line buffering even when writing to a non-TTY, a typical idiom

tail -f using PuTTY hangs

笑着哭i 提交于 2019-12-08 02:45:05
问题 I am using PuTTY command line to connect to a server and tail a log file. On local machine I've created a file "tail-exec" which contains following text: tail -f /var/log/test.log I am starting putty through command line as: putty -ssh -t -pw -m tail-exec user@server This opens up the terminal window with log tail. But the problem is that this terminal hangs after there are few hundred lines added to the log. If I open putty manually, and then run the tail command from the bash prompt, then