Nginx offers a variety of webserver functionality, including load balancing, HTTP cache - and of course the HTTP webserver itself.
Create a new file in your rsyslog.d directory, we called it 21-Nginx-Logscape.config, inside it place the following
$InputFilePollInterval 10 $PrivDropToGroup adm $WorkDirectory /var/spool/rsyslog # Nginx access file: $InputFileName /var/log/Nginx/access.log $InputFileTag Nginx-access: $InputFileStateFile stat-Nginx-access $InputFileSeverity info $InputFilePersistStateInterval 20000 $InputRunFileMonitor #Nginx Error file: $InputFileName /var/log/Nginx/error.log $InputFileTag Nginx-error: $InputFileStateFile stat-Nginx-error $InputFileSeverity error $InputFilePersistStateInterval 20000 $InputRunFileMonitor #Add a tag for Nginx events template CloudNginx,"LOGSCAPETOKEN:YOUR_SECURITY_TOKEN_HERE LOGSCAPETAG:Nginx <%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% %msg%" *.* @@lscape1.logscape.com:1468;CloudNginx if $programname == 'Nginx-access' then @@10.28.1.159:1468;CloudNginx if $programname == 'Nginx-access' then ~ if $programname == 'Nginx-error' then @@10.28.1.159:1468;CloudNginx if $programname == 'Nginx-error' then ~
You'll also need to check your rsyslog.conf to make sure the following module has been loaded.
$ModLoad imfile2) Restart the Syslog daemon
Now restart your Syslog daemon.
sudo service rsyslog restart3) Check Logscape for connectivity
Log into the Logscape Cloud and check the web workspaces to see your data.