I maintain many virtualhosts (over 60) hosted on a Centos server running Apache. The virtualhosts gets created using Plesk, which creates separate log files for each domain using the following pattern /var/www/vhosts/<domain_name>/statistics/logs/{access,error}_log.

I would like to centralize all these logs on another server to parse them with elasticsearch + logstash. Currently I have a bash script which create a <domain>.conf file in the /etc/rsyslog.d/ for each domain contained in the /var/www/vhosts dir, with the following configuration:

InputFileName /var/www/vhosts/<domain_name>/statistics/logs/access_log
$InputFileTag apache-access:
$InputFileStateFile state-apache-access

Is there a way to create a single .conf file which will send all the logs to my central logging server? Something like $InputFileName /var/www/vhosts/*/statistics/logs/access_log

Any help is appreciated!


AFAIK rsyslog doesn't support wildcards in filenames. nxlog does. In addition it can parse apache logs and can send it to elasticsearch over http. You might want to take a look at it. (Disclaimer: I'm affiliated with the project.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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