Apache combined log

Hi, Is there a combined apache access & error log?
I can see the per domain logs in /var/log/virtualmin, but the access.log in /var/log/apache2 is empty.

Thanks

Anyone have any suggestions?

maybe use

mod_journald

to have the output directed to the journal and then query the journal for the information there.
mod_journald docs. I have never bothered to set it up so I don’t know if this will write to the journal as the apache user or as apache itself, if it writes as the apache user then a command such as

journalctl -u <apache_user> (other journalctl options)

will then show a combined output. As I have said this is untested and only a suggestion so it may or may not work, just wondering why do you want a combined output as the files can have different outputs which would make parsing the file a little difficult

There is not. At least not by default. Generally combining logs from different users would be the last thing you’d want.

You’d need to configure it yourself. I think Virtualmin would be unhappy with you, though, as it expects to be able to show users their own logs.

Configuring it is as simple as removing the CustomLog and ErrorLog directives from your virtual hosts. You need those configured at the top level outside of any virtual hosts, as well, but that’s there by default, I believe.

I think I’d recommend you keep them separate and create a cronjob to aggregate the logs daily or weekly instead for whatever processing needs all logs in one file.

Thanks for the tips, I wish to keep the existsing domain logs, I just wanted an additional log that was combined, so CSF can track hits to apache and take action if required.

Cheers

Can’t CSF track multiple logs?

It can, but then each time a new domain is added, I’d need to remeber to add that log to the CSF config.

I don’t know why you’d do that.

There may be an easier way to do it, but I don’t use CSF so I don’t know.

@Ilia, is there already some kind of support for automatically adding new Apache access_logs to CSF when a new domain is added?

@Joe, no, I remember this being a puzzle back in time. I can’t remember how I solved it. I think I just combined all logs from all domains into one since I was the only user on the system.

Still, I’d prefer to keep them separate now and just automate adding and removing entries from the CSF config.