dalibu
By:
dalibu

How do I view logs from multiple virtual hosts with logwatch on Ubuntu 14.04?

June 18, 2015 1.2k views
Logging Linux Basics

Currently I have logwatch running, and via cron job it will send an email to me each evening. In the email it will list the http requests, however, it is not possible to see which virtual host they come from. For example I a report will say:

Requests with error response codes
403 Forbidden
/wp-content/uploads/: 2 Time(s)

It would be better if it said:

Requests with error response codes
403 Forbidden
www.mydomain.com/wp-content/uploads/: 2 Time(s)

Any ideas?

1 Answer

It seems I have answered my own question. I changed this line in apache2.conf:

LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined

into this:

LogFormat "%h %l %u %t \"%m %{Host}i%U%q %H\" %>s %b" combined
Have another answer? Share your knowledge.