2

Part of my verification checks include verifying log files on Linux machines. When entering a defect sometimes the log files also contain useful information. With Putty I create a remote shell on the machine, however verifying each log file with Grep, Tail or MultiTail is a tedious job.

Does anybody know of tools that allow following scenarios?

  1. Present the log files in an webapplication on my Linux machine.
  2. Present the Linux log files in a Windows application.
  3. Monitor automatically the log files while monitoring for a trigger condition that I can set, so that I get a message somehow. Since the types of logs are quite different, it is difficult to say exactly which trigger condition. A regular expression would be most flexible of course.

I had expected these would exist, but a websearch didn't return much beyond tail -f.

2
  • Chris, to help us provide a good answer, can you edit your question to add more detail about item 3? What kind of trigger conditions?
    – user246
    Commented Apr 28, 2015 at 13:50
  • I would place a little bash script which always checks whether there are log files or not. If you want to check whether the log files has changed or not, then it requires little condition magic in it, but doable. However, it is doable whatever programming language you know. Commented Apr 28, 2015 at 13:53

2 Answers 2

1

You can try this approach:

tail -f file | grep --line-buffered my_pattern

This should meet all 3 criteria, given a robust enough regex.

I originally learned this from https://stackoverflow.com/questions/7161821/how-to-grep-a-continuous-stream

0

much beyond tail -f

This is THE best answer, I am not a Linux expert, nor is this in the scope of this SE and the original question is too wide. But Linux has one of the best log processing tool sets, tail being part of them.

For example you can use tail -f with grep then redirect the output to a file will create a trigger for you. Using Lucas example-

tail -f file | grep --line-buffered my_pattern > trigget-file

You can track it from windows using remote shell, or even by sharing the directory.

If going through multiple log files is tedious than use a shell script to do it for you.

2
  • 1
    Hi Rsf, your answer would be more valuable if you were to elaborate on why tail -f is the best answer for the OP's specific requirements, particularly #3.
    – user246
    Commented Apr 28, 2015 at 16:35
  • @user246 I think Rsf elaborated since then. Consider removing the downvote. Thanks.
    – alecxe
    Commented Jul 7, 2017 at 1:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.