I need your help.


 
Thread Tools Search this Thread
Operating Systems Solaris I need your help.
# 15  
Old 09-07-2008
It can be done without reading the file if that is a requirement.

You should tell more about what this log file is, what process(es) are writing to it, at what rate and what Solaris release you are using.
# 16  
Old 09-07-2008
Quote:
It can be done without reading the file if that is a requirement.
Interesting ! Smilie

How is that possible to know a pattern in a file without actually reading it ?

I think this is not possible.

Did you mean, hiding or encapsulating the reading interface ?
# 17  
Old 09-07-2008
Quote:
Originally Posted by matrixmadhan
How is that possible to know a pattern in a file without actually reading it ?
I hope you'll agree the process which wrote it successfully knows it is there without needing to read the output file.
# 18  
Old 09-07-2008
Quote:
I hope you'll agree the process which wrote it successfully knows it is there without needing to read the output file.
Yes, thats right. But in the most of the cases the systems are loosely coupled by design such that each of the unit performs their job so seldom you could control the functionality or add functionality to process that is creating the log messages.

For example:

Its not obvious that I request DW team to WebServer team to redirect all <example_logs> to be suppressed or erase. It is upto the reporting team to filter that out from the apache/website logs to not use them.

That is the reason, I didnt give out that possibility.

In any case, I don't mean to deny what you had said. I just assumed ( over - assumed ) thats not going to be the case.

Smilie
# 19  
Old 09-07-2008
I think it needs to be said again: tail -f sounds like the ticket. You can combine the tail -f and the grep in a simple Perl script. Whatever the implementation, the idea is to keep the file open, and attempt to read another line, say, once per second, or once every five seconds. If the read fails, it means no data has been appended to the file. If it succeeds, there is new data; read and examine, and if it's a hit, take some action (terminate? send another process a signal? send an email?)
# 20  
Old 09-07-2008
Please could you explain a little more Smilie .... Im not fimailiar with tail -f command.... what does it do exactly ?

Thanks
# 21  
Old 09-07-2008
Whenever there is an update to file opened via tail -f, the updates get dumped as output.

You could have a look at man pages for tail
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question