The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

syslog-ng recipe

This is a recipe for installing/configuring syslog-ng on a system, registering the syslog-ng service in SMF, starting syslog-ng, and stopping the standard syslog daemon.

The only generic piece right now is the config file —– everything else is Solaris 10 specific primarily because that is my current focus and I haven’t had time to do anything with other OSes.

 # syslog-ng.pp
#
# Class for syslog-ng clients that installs the syslog-ng software, populates a default config file, starts the syslog-ng daemon, and stop the syslog daemon.
#
# Note: This class is NOT for syslog-ng servers (e.g. the centralized loghost).
#
class syslog-ng {
        # create syslog-ng.conf file from UCR template
        file { "/etc/syslog-ng.conf":
                owner => root,
                group => root,
                mode => 440,
                source => "puppet:///dist/apps/syslog-ng/syslog-ng.conf"
        }

        case $operatingsystem {
                solaris: {
                        # create the syslog-ng package staging directory
                        file { "/sysprov/dist/apps/syslog-ng":
                                owner => puppet,
                                group => puppet,
                                ensure => directory
                             }

                        # copy the syslog-ng package from the puppetmaster
                        file { "/sysprov/dist/apps/syslog-ng/UCRsyslog-ng-1-6-11":
                                owner => puppet,
                                group => puppet,
                                source => "puppet:///dist/apps/syslog-ng/UCRsyslog-ng-1-6-11",
                                ensure => present
                             }

                        # install UCRsyslog-ng-currentversion
                        package { "UCRsyslog-ng-1-6-11":
                                ensure => installed,
                                provider => sun,
                                source => "/sysprov/dist/apps/syslog-ng/UCRsyslog-ng-1-6-11",
                                require => File[ "/sysprov/dist/apps/syslog-ng/UCRsyslog-ng-1-6-11" ]
                                }

                        # remove symlinks to UCRsyslog-ng-previousversion
                        exec { "/inst/pkg/graft/bin/graft -d -D /opt/UCR/UCRsl-ng/syslog-ng" :
                        refreshonly => true
                             }

                        # remove UCRsyslog-ng-previousversion
                        package { "UCRsl-ng":
                                ensure => absent,
                                provider => sun,
                                }

                        # create symlinks in /usr/local to UCRsyslog-ng-currentversion
                        exec { "/inst/pkg/graft/bin/graft -i /opt/UCR/UCRsyslog-ng-1-6-11" :
                             }

                # Copy the SMF related files from the puppetmaster
                                 case $operatingsystemrelease {
                                 "5.10": {

                                        # syslog-ng SMF Manifest
                                        file { "/var/svc/manifest/system/syslog-ng.xml":
                                                owner => root,
                                                group => root,
                                                mode => 555,
                                                source => "puppet:///dist/apps/syslog-ng/syslog-ng.xml",
                                                ensure => present
                                             }

                                        # syslog-ng SMF svc.method
                                        file { "/lib/svc/method/syslog-ng" :
                                                owner => root,
                                                group => root,
                                                mode => 555,
                                                source => "puppet:///dist/apps/syslog-ng/svc.method.syslog-ng",

                                             }

                                        exec { "`svccfg import /var/svc/manifest/system/syslog-ng.xml`" :

                                             }
                                 }
                                 }
                                 }
                        }
                # Start the syslog-ng service
                        case $operatingsystemrelease {
                        # for Solaris 10
                        "5.10": {
                                service { syslog-ng:
                                        ensure => "running",
                                        }
                              }

                        # Stop the standard syslog service
                        case $operatingsystemrelease {
                        # for Solaris 10
                        "5.10": {
                                service { system-log:
                                        ensure => "stopped",
                                        }
                              }

                }


}