It looks like python is buffering output so there is no external way to view the results until python flushes its output buffer. Normally this will happen when the buffer fills and when python closes the output file. If you have permission to change the python source file (example.py), consider adding flush() calls to appropriate spots in the code so tail will be able to see data written to the file after significant updates are written.
Thank you very much, this is the problem!
It can be solved adding a flush() method after the prints you want to flush:
Adding a flush() class like this:
Or more easily adding -u option when invoke python:
then with tail command see any print in real time:
Thanks a lot
Solved
Last edited by Tieso; 06-30-2013 at 04:48 PM..
Reason: I don't see where edit thread title for change to Solved
Hi all,
i would like to write the shell script program, it can monitor the access_log "real time"
when the access_log writing the line contain "abcdef" the program will be "COPY" this line into a file named "abcdef.txt", do the same thing if the contain "123456" "COPY" it into a file named... (3 Replies)
Hello,
I have a Apache webserver running on RedHat. Its primary function is a proxy server for users accessing the internet. I have a transaction log that logs every transactions of every users. For users trying to access certain sites/content the transactions goes into a 302 redirect loop and... (2 Replies)
Hi,
On the server, we have app log files in this location /app/logs/error.log
On the same server, in a real time, we would like to replicate that into /var/ directory.
if someone has already done this, please share the script.
Thanks in advance. (4 Replies)
Hey all, I have a problem I was hoping to get some help on. So I have my two auditfiles, audfile1 and audfile2 that can be written to, I want to have the text version of them write to an NFS mount that I have set up. So i already know that i can do .secure/etc/audsp audfile1 > //nfsmount/folder/... (5 Replies)
Hi,
I have a log file that gets updated every second. Currently the size has grown to 20+ GB. I need to have a command/script, that will try to get the actual size of the file and will remove 50% of the data that are in the log file. I don't mind removing the data as the size has grown to huge... (8 Replies)
Hello All,
I am building a real time parser for a log file in my application.
The log file is continuously written at a very fast pace and gets rolled over every 10 minutes.
I have measured the speed and observed that around 1000 lines are written to it every second, each line about 30-40... (7 Replies)
Below is my script to log all the command input by any user to /var/log/messages. But I cant achieve the desired output that i want. PLease see below.
function log2syslog
{
declare COMMAND
COMMAND=$(fc -ln -0)
logger -p local1.notice -t bash -i -- "$USER:$COMMAND"
}
trap... (12 Replies)
Discussion started by: invinzin21
12 Replies
LEARN ABOUT OPENSOLARIS
flush
flush(1T) Tcl Built-In Commands flush(1T)__________________________________________________________________________________________________________________________________________________NAME
flush - Flush buffered output for a channel
SYNOPSIS
flush channelId
_________________________________________________________________DESCRIPTION
Flushes any output that has been buffered for channelId.
ChannelId must be an identifier for an open channel such as a Tcl standard channel (stdout or stderr), the return value from an invocation |
of open or socket, or the result of a channel creation command provided by a Tcl extension. The channel must have been opened for writing.
If the channel is in blocking mode the command does not return until all the buffered output has been flushed to the channel. If the chan-
nel is in nonblocking mode, the command may return before all buffered output has been flushed; the remainder will be flushed in the back-
ground as fast as the underlying file or device is able to absorb it.
EXAMPLE
Prompt for the user to type some information in on the console:
puts -nonewline "Please type your name: "
flush stdout
gets stdin name
puts "Hello there, $name!"
SEE ALSO file(1T), open(1T), socket(1T), Tcl_StandardChannels(3TCL)KEYWORDS
blocking, buffer, channel, flush, nonblocking, output
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWTcl |
+--------------------+-----------------+
|Interface Stability | Uncommitted |
+--------------------+-----------------+
NOTES
Source for Tcl is available on http://opensolaris.org.
Tcl 7.5 flush(1T)