A scalable approach to pure logging (as when using only syslog components) can be implemented using syslog-ng
syslog-ng is syslog ++, so it will not break any syslog configurations and logging if you already have some. Installing on Ubuntu is simple:
sudo apt-get install syslog-ng
for installation on windows, see http://www.syslog.org/logged/running-syslog-ng-on-windows/
Several django applications or several servers are logged into syslog-ng, which uses UDP or TCP (depending on your configuration), to send it to the central syslog-ng server, which logs it to this computer. You can use basic regex to identify the application in syslog-ng and route it accordingly.
Django Log Configuration
'syslog-verbose': { 'format': 'myapp %(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' } 'ConcurrentLogHandler':{ 'level': 'DEBUG', 'class': 'logging.handlers.SysLogHandler', 'formatter': 'syslog-verbose', },
Note the line "myapp" added to the formatter to identify the syslog-ng application.
You can configure nginx, apache and other servers to log in to syslog-ng. For instance. for apache:
CustomLog "| /usr/bin/logger -t 'apache' -u /var/run/apache_access_log.socket" combined
Syslog-ng client configuration
Add this to the end of / etc / syslog -ng / syslog-ng.conf
filter filter_loghostclient { program("^myapp$"); }; destination dest_loghostclient { tcp("destination_logserver.example.com" port (514)); }; log { source(s_all); filter(filter_loghostclient); destination(dest_loghostclient); }; source s_apache_access {
Syslog-ng aggregator configuration
Add the following to the syslog-ng configuration file: destination_logserver.example.com
source src_loghostserver { tcp(port(514) keep-alive(yes) max_connections(1000)); }; destination dest_loghostserver { file("/var/log/myproject/request_\$R_YEAR\$R_MONTH\$R_DAY.log"); }; log { source(src_loghostserver); destination(dest_loghostserver); };