Search code examples
rsyslogsyslog-ng

rsyslog server generating log files named for IP address instead of access_log


I have a syslog-ng server configured to send all apache log messages to a remote rsyslog server. Here are the pertinent part of my syslog-ng server's config:

source s_http {
    file("/var/log/httpd/access_log" flags(no-parse));
};

...

destination loghost { tcp("10.0.0.48" port(514)); }; 

...

log { source(s_http); destination(loghost); };

I was hoping to find on the remote rsyslog server (10.0.0.48) the file: /apps/log/my-web-server/access_log. but instead I find several files in the /apps/log/my-web-server/ named for the IP address of the clients that hit my-web-server with a .log extension.

[root@10.0.0.48]# pwd
/apps/log/my-web-server
[root@10.0.0.48]# ls -l
total 140
-rw-------. 1 root root   4862 Aug 14 16:39 10.0.0.97.log
-rw-------. 1 root root    193 Aug 14 15:45 10.0.0.201.log

Why aren't the log messages going into one file named access_log?

Update:

On the rsyslog server at 10.0.0.48 I see these lines in the /etc/rsyslog.conf

$template RemoteStore, "/apps/log/%HOSTNAME%/%PROGRAMNAME%.log"
$template RemoteStoreFormat, "%msg%\n"
:source, !isequal, "localhost" -?RemoteStore;RemoteStoreFormat
:source, isequal, "last" STOP

what does that mean?


Solution

  • I needed to change ...

    source s_http {
        file("/var/log/httpd/access_log" flags(no-parse));
    };
    

    ... to this ...

    source s_http {
        file("/var/log/httpd/access_log" program-override("apache_access_log"));
    };