diff --git a/README.md b/README.md index 4f58bab..761e08f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Automate your Loggly config with Puppet -If you've ever had to manage servers, you're probably very familiar with an age-old problem: "How do I keep track of what's happening on all of my systems?" +If you've ever had to manage servers, you're probably very familiar with an age-old problem: "How do I keep track of what's happening on all of my systems?" -[Loggly](http://loggly.com/) is a tool that can help you solve that very problem by bringing your logs from all of your systems into a central, easy-to-use dashboard. +[Loggly](http://loggly.com/) is a tool that can help you solve that very problem by bringing your logs from all of your systems into a central, easy-to-use dashboard. Unfortunately, if you've got more than a handful of servers, it quickly becomes tedious to manage their configuration by hand. Since we're still years away from being able to delegate the setup to robot minions, the Loggly team has created a [Puppet](http://puppetlabs.com/puppet/what-is-puppet) module to get Puppet users up and running right away. @@ -180,9 +180,32 @@ node 'my_server_node.example.net' { } } ``` -Unfortunately, the packages in the EPEL repository for syslog-ng are not compiled with TLS support by default, so TLS is +Unfortunately, the packages in the EPEL repository for syslog-ng are not compiled with TLS support by default, so TLS is disabled by default on Red Hat-style distributions. Data sent from your systems to Loggly will not be encrypted by default. + +#### If you want to log custom logfiles + +```puppet + +node 'my_server_node.example.net' { + class { 'loggly::rsyslog': + customer_token => 'de7b5ccd-04de-4dc4-fbc9-501393600000', + } + + loggly::rsyslog::logfile { "custom-logfile": + logname => "custom-logfile", + filepath => "/var/log/custom-logfile.log" + } + + loggly::rsyslog::logfile { "mysql": + logname => "mysql", + filepath => "/var/log/mysqld.log" + } +} +``` + + #### Additional information More information on available configuration options can be found in the source code for the Loggly Puppet module. diff --git a/manifests/rsyslog.pp b/manifests/rsyslog.pp index c29a9ec..dba073f 100644 --- a/manifests/rsyslog.pp +++ b/manifests/rsyslog.pp @@ -76,6 +76,13 @@ refreshonly => true, } + define logfile($logname,$filepath,$severity='info') { + file { "/etc/rsyslog.d/$logname.conf": + content => template("loggly/log.conf.erb"), + notify => Exec["restart_rsyslogd"], + } + } + } # vi:syntax=puppet:filetype=puppet:ts=4:et: diff --git a/templates/log.conf.erb b/templates/log.conf.erb new file mode 100644 index 0000000..5dace6f --- /dev/null +++ b/templates/log.conf.erb @@ -0,0 +1,12 @@ +# Loggly +$ModLoad imfile +$InputFilePollInterval 10 + +#<%= logname %> +$InputFileName <%= filepath %> +$InputFileTag <%= logname %>: +$InputFileStateFile stat-<%= logname %>-log +$InputFileSeverity <%= severity %> +$InputRunFileMonitor + +