views:

1702

answers:

2

Hi,

I am trying to send all my apache logs to syslog-ng(on remote machine) which in turn writes to a file.

so I configure syslog-ng this way

source s_apache {
      unix-stream("/var/log/apache_log.socket" max-connections(512) keep-alive(yes));
};
filter f_apache { match("error"); };
destination df_custom { file("/var/log/custom.log"); };
log {
        source(s_apache);
        filter(f_apache);
        destination(df_custom);
};

and add the following line to apache2.conf

ErrorLog "|/usr/bin/logger -t 'apache'  -u /var/log/apache_log.socket"

but only logs being written to "/var/log/custom.log" are

[Mon Jul 13 17:24:36 2009] [notice] caught SIGTERM, shutting down

and

[Mon Jul 13 17:26:11 2009] [notice] Apache/2.2.11 (Ubuntu) configured -- resuming normal operations

I want all logs to be sent to custom.log..... Please help me.... where am I going wrong?

A: 

I can suggest to you this link: http://httpd.apache.org/docs/2.2/logs.html Here you can learn about log on apache. If you want all log on syslog-ng, you must configure also access logs with CustomLog directive.

Regards, Lorenzo.

lg
ok....but I am not receiving all the error logs atleast.....I deliberately tried to access some file which does n't exist thru some php application which is served by apache......those logs are going to standard apache error log file...i.e., /var/log/apache2/error.log
uzumaki naruto
Are you working with virtualhost?
lg
+1  A: 

I had the same problem, and i found that the the ErrorLog and CustomLog settings were getting overwritten by /etc/apache2/sites-available/default

After commenting out those, it worked !

Or you can just put these settings in < virtualhost > if you want to log only specific domain calls

Regards rane

rane