Skip to content

Instantly share code, notes, and snippets.

@firstrow
Forked from amoslanka/rsyslog.conf
Last active August 29, 2015 14:06
Show Gist options
  • Save firstrow/3b97399eed5b4d23b6db to your computer and use it in GitHub Desktop.
Save firstrow/3b97399eed5b4d23b6db to your computer and use it in GitHub Desktop.
#################
#### MODULES ####
#################
$ModLoad imuxsock # provides support for local system logging
$ModLoad imfile
###########################
#### GLOBAL DIRECTIVES ####
###########################
$SystemLogSocketFlowControl on
#
# Use traditional timestamp format.
# To enable high precision timestamps, comment out the following line.
#
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
# Filter duplicated messages
# $RepeatedMsgReduction on
#
# Set the default permissions for all log files.
#
$FileOwner syslog
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
$PrivDropToUser syslog
$PrivDropToGroup adm
###########################
###### INPUT FILES ########
###########################
$InputFileName /var/log/nginx/access.log
$InputFileTag nginx:
$InputFileStateFile stat-nginx-access
$InputFileSeverity info
$InputRunFileMonitor
$InputFileName /var/log/nginx/error.log
$InputFileTag nginx:
$InputFileStateFile stat-nginx-error
$InputFileSeverity info
$InputRunFileMonitor
# (this is a custom php error log location)
$InputFileName /var/log/php/error.log
$InputFileTag php:
$InputFileStateFile stat-php-error
$InputFileSeverity error
$InputRunFileMonitor
#################################
####### OUTPUT TO LOGGLY ########
#################################
# Define the template used for sending logs to Loggly. Do not change this format.
$template LogglyFormat,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [TOKEN@41058] %msg%\n"
# Send messages to Loggly over TCP using the template.
if $programname == 'nginx' then @@logs-01.loggly.com:514;LogglyFormat
if $programname == 'php' then @@logs-01.loggly.com:514;LogglyFormat
# $DirCreateMode 0700
# $FileCreateMode 0644
if $programname == 'nginx' then /var/log/loggly;LogglyFormat
if $programname == 'php' then /var/log/loggly;LogglyFormat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment