PyTis
PyTis

Reputation: 1134

How to use multitail with grep on each input file

My company's server runs Apache for MANY sites, but only has 1 (one) access.log and 1 (one) error.log. One of the sites gets a lot of traffic, causing the logs to fly by on the screen fairly quickly, when using:

tail -f access.log

or

tail -f error.log

I want to use...

multitail access.log error.log

...but this won't work, as I won't even be able to see my seldom traffic.

However, I can grep out the sitename, and see only the access or error log for the site I am working on with a simple grep:

tail -f error.log | grep dev_db

This works, but only for one of the two logs at a time.

The thing is, I want to see both logs in the standard split-screen that multitail offers.
I wish to multitail the two files (access & error) but grep for specific lines containing the sitename.

How can I do this? I've man`ed multitail, and I have seen the -E for regular expressions, but I don't think that would work (and if it would, then I don't know how to use it correctly.

If there is a way to do this, would you please use the "dev_db" in your response showing me how to do it?

--

--

Please, and Thank You

Upvotes: 2

Views: 695

Answers (1)

The fourth bird
The fourth bird

Reputation: 163362

You can run -E as described in the man page:

-E Use the next regular expression on the following files.

multitail -E dev_db file1 file2

Upvotes: 2

Related Questions