How to get custom logs such as nginx to be included in bandwidth monitoring

I have setup nginx as a proxy server to apache to serve static content. But, I would like the ngnix traffic to be included in each virtual server’s bandwidth monitoring. Is it possible to do this?

I’ve blogged about how I’ve set things up here: http://hartlessbydesign.com/blog/view/206-virtualmin-apache-and-nginx-reverse-proxy

Thanks,
Alan

Hi Alan,

That’s a nice blog entry you have there, thanks for sharing that!

I’m not sure of the answer to your question though – I’ll see if Jamie has any insight on that :slight_smile:

Thanks!

-Eric

Okay, Jamie says that while there isn’t an officially supported manner of doing this – it may be possible to get it to work.

What you could do is try having Nginx write its logs to /var/log/virtualmin/${DOM}_access_log_nginx .

Virtualmin will include all log files that start with ${DOM}_access_log, in order to pick up rotated logs. And that can be used to include the logs from other webservers, such as Nginx, in the bandwidth statistics.

The issue though is that It might lead to double-counting, as a request to Nginx would be logged and then proxied to Apache, which would log it again…\

-Eric