Skip to content

Instantly share code, notes, and snippets.

@joeypiccola
Created July 24, 2019 19:33
Show Gist options
  • Save joeypiccola/70d1cb4e9e543ae1c6aed110c7091290 to your computer and use it in GitHub Desktop.
Save joeypiccola/70d1cb4e9e543ae1c6aed110c7091290 to your computer and use it in GitHub Desktop.
puppet code to manage how the puppet agent writes windows events
# move puppet windows events out of the Application log into a new log named Puppet
if $facts['os']['family'] == 'windows' {
registry_key { 'Application_Puppet':
ensure => absent,
path => 'HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\Puppet',
}
registry_key { 'Puppet_Puppet':
ensure => present,
path => 'HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Puppet\Puppet',
require => Registry_key['Application_Puppet'],
}
registry_value { 'EventMessageFile':
ensure => present,
path => 'HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Puppet\Puppet\EventMessageFile',
type => string,
data => 'C:\Program Files\Puppet Labs\Puppet\puppet\bin\puppetres.dll',
notify => Exec['Force_restart_eventlog'],
require => Registry_key['Puppet_Puppet'],
}
exec { 'Force_restart_eventlog':
command => 'Restart-Service -Name EventLog -Force',
refreshonly => true,
provider => powershell,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment