Search code examples
windowsloggingservicepuppet

How to modify the default `--logdest eventlog` for the Puppet Agent service on Windows?


I'm running Puppet Agent as a service on Windows but I'm unable to find in the docs how to modify the default behaviour --logdest eventlog to --logdest <FILE>. I want to have agent logs stored in a file, and not in the Windows Event Log, or better - if that's possible - have them sent back to the Puppet Master.


Solution

  • You can add the --logdest to the 'ImagePath' value located in this registry key:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\pe-puppet

    We add the switch through puppet code after the agent is installed, meaning that the first run output goes to the event log, but all the subsequent are sent to the local file. You can also modify the reg key during install through a powershell script.