Skip to content

Instantly share code, notes, and snippets.

@fooforge
Created May 5, 2013 21:20
Show Gist options
  • Save fooforge/5522216 to your computer and use it in GitHub Desktop.
Save fooforge/5522216 to your computer and use it in GitHub Desktop.
This is a logserver sample config for rsyslog that enables you to separate the GitHub Enterprise VM's log files by $programname. (/etc/rsyslog.conf, /etc/rsyslog.d/99-central.conf)
$template DYNexceptions, "/var/log/hosts/%HOSTNAME%/exceptions.log"
$template DYNgit_auth, "/var/log/hosts/%HOSTNAME%/github_gitauth.log"
$template DYNgit_http, "/var/log/hosts/%HOSTNAME%/github_git-http-server.log"
$template DYNmemcached, "/var/log/hosts/%HOSTNAME%/github_memcached.log"
$template DYNnodeload, "/var/log/hosts/%HOSTNAME%/github_nodeload.log"
$template DYNredis, "/var/log/hosts/%HOSTNAME%/redis.log"
$template DYNresque, "/var/log/hosts/%HOSTNAME%/github_resque.log"
$template DYNsolr, "/var/log/hosts/%HOSTNAME%/solr.log"
$template DYNsolr_build_indexes, "/var/log/hosts/%HOSTNAME%/solr_indexes.log"
$template DYNunicorn, "/var/log/hosts/%HOSTNAME%/github_unicorn.log"
$template DYNenterprise-manage_unicorn, "/var/log/hosts/%HOSTNAME%/enterprise-manage_unicorn.log"
$template DYNslumlord_unicorn, "/var/log/hosts/%HOSTNAME%/github_slumlord_unicorn.log"
$template DYNweblogs, "/var/log/hosts/%HOSTNAME%/github_access.log"
if \
$source != 'localhost' \
and \
$programname == 'github_exceptions' \
then ?DYNexceptions
& ~
if \
$source != 'localhost' \
and \
$programname == 'github_gitauth' \
then ?DYNgit_auth
& ~
if \
$source != 'localhost' \
and \
$programname == 'github_git_http_server' \
then ?DYNgit_http
& ~
if \
$source != 'localhost' \
and \
$programname == 'github_memcached' \
then ?DYNmemcached
& ~
if \
$source != 'localhost' \
and \
$programname == 'nodeload' \
then ?DYNnodeload
& ~
if \
$source != 'localhost' \
and \
$programname == 'github_redis' \
then ?DYNredis
& ~
if \
$source != 'localhost' \
and \
$programname == 'github_resque' \
then ?DYNresque
& ~
if \
$source != 'localhost' \
and \
$programname == 'solr' \
then ?DYNsolr
& ~
if \
$source != 'localhost' \
and \
$programname == 'github_solr_index_build_gists' \
then ?DYNsolr_build_indexes
& ~
if \
$source != 'localhost' \
and \
$programname == 'github_unicorn' \
then ?DYNunicorn
& ~
if \
$source != 'localhost' \
and \
$programname == 'enterprise_manage_unicorn' \
then ?DYNenterprise-manage_unicorn
& ~
if \
$source != 'localhost' \
and \
$programname == 'slumlord_unicorn' \
then ?DYNslumlord_unicorn
& ~
if \
$source != 'localhost' \
and \
$programname == 'github_access' \
then ?DYNweblogs
& ~
# /etc/rsyslog.conf Configuration file for rsyslog.
#
# For more information see
# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
#
# Default logging rules can be found in /etc/rsyslog.d/50-default.conf
#################
#### MODULES ####
#################
$ModLoad imuxsock # provides support for local system logging
$ModLoad imklog # provides kernel logging support (previously done by rklogd)
#$ModLoad immark # provides --MARK-- message capability
# provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 5140
# provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 5140
###########################
#### GLOBAL DIRECTIVES ####
###########################
#
# 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 syslog
#
# Where to place spool files
#
$WorkDirectory /var/spool/rsyslog
#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment