in reply to Re^4: Searching a string in running file
in thread Searching a string in running file

With the shell tail function, you will hit the current EOF. You cannot read past the EOF. After awhile (suitable time delay for your application), you have to do another tail in order to see additional lines that have been added. This is normal.

Without knowing much about your particular problem (one example line is not much to go on), sometimes in this situation, all that is needed is to monitor the size of the file and just verify that it continues to grow. my $size = -s "logfile";. Of course that won't work if the program continues to grow the file in spite of being in some kind of error mode.

Update: The system tail command should be adequate for what you need. I presume that you are only doing this once per 30-60 seconds? Or maybe even less often? Also consider whether or not a simple line "eq" string comparison is adequate (current last line not identical to the last line at the last time that we checked). It could be that you don't even need a regex? Again without more details about this log file, it is impossible to say. If you show evidence to reject my simple "check file size" suggestion, then along the way you will provide us with enough data to write a proper regex for you.