Skip to content

Instantly share code, notes, and snippets.

@vnisor
Created January 12, 2014 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vnisor/8380493 to your computer and use it in GitHub Desktop.
Save vnisor/8380493 to your computer and use it in GitHub Desktop.
#Only needs to be loaded once, like most rsyslog modules
$ModLoad imfile
#path to the file which you want to monitor
$InputFileName /var/log/apache2/access.log
#The tag apache can be changed to whatever you'd like
$InputFileTag apache:
#the name of file within rsyslogs working directory
$InputFileStateFile stat-apache-access
#By default this is set to 'notice'
$InputFileSeverity info
#This is necessary for file monitoring (no parameters)
$InputRunFileMonitor
#Set to how often the file should be polled. (default = 10s)
$InputFilePollInterval 10
# This is a template for Loggly. Substitute your Customer Token for TOKEN
$template LogglyFormatApache,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [TOKEN@41058 tag=\"apache\"] %msg%\n"
# Make sure the template above is on one line.
if $programname == 'apache' then @@logs-01.loggly.com:514;LogglyFormatApache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment