Created
March 29, 2014 06:30
-
-
Save zoellner/9849597 to your computer and use it in GitHub Desktop.
Configure AWS Elastic Beanstalk syslog to poll nginx logs (in order to send them to loggly)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# configure rsyslogd to include logfiles from nginx/apache | |
# needs 010_loggly.config | |
# Save this file as .ebextensions/015_nginx-loggly.config | |
# replace TOKEN | |
# Deploy per normal scripts or aws.push. To help debug the push, ssh & tail /var/log/cfn-init.log | |
# See Also /var/log/eb-tools.log | |
# | |
files: | |
"/etc/rsyslog.d/21-nginx-loggly.conf" : | |
mode: "000644" | |
owner: root | |
group: root | |
content: | | |
$ModLoad imfile | |
$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 LogglyFormat,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [TOKEN@41058 tag=\"nginx\"] %msg%\n" | |
if $programname == 'nginx-access' then @@logs-01.loggly.com:514;LogglyFormat | |
if $programname == 'nginx-access' then ~ | |
if $programname == 'nginx-error' then @@logs-01.loggly.com:514;LogglyFormat | |
if $programname == 'nginx-error' then ~ | |
commands: | |
010_create_rsyslog_folder: | |
command: su --session-command="mkdir -p /var/spool/rsyslog" | |
ignoreErrors: true | |
services: | |
sysvinit: | |
rsyslog: | |
ensureRunning: true | |
files: "/etc/rsyslog.d/21-apache-loggly.conf" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi thanks, where can i get 010_loggly.config ?