Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows client should be configured with log rotation #165

Closed
cwjohnston opened this issue Mar 16, 2017 · 8 comments
Closed

Windows client should be configured with log rotation #165

cwjohnston opened this issue Mar 16, 2017 · 8 comments
Assignees

Comments

@cwjohnston
Copy link
Contributor

cwjohnston commented Mar 16, 2017

As described in sensu/sensu-puppet#618, the Windows client is not configured with log rotation by default. This can lead to large log files filling the disk, causing other failures as a result.

Looks like winsw has support for log rotation. Now that we have a sensu-client.xml that can start the service without additional configuration, I think we should probably configure log rotation by default as well.

@dzeleski
Copy link

I have a pull open here for the sensu-puppet project that fixes this via a xml template: sensu/sensu-puppet#621

Im using a limit of 10MB so that notepad doesnt hang when trying to open it, a total of 100MB should be sufficient for most places I would guess.

Also TY I did not know this project existed :)

@portertech portertech removed this from the 0.29 milestone Mar 29, 2017
@amdprophet
Copy link
Member

It seems that the winsw log rotation is limited to the rotation of logs generated by winsw itself and not Sensu. We will be investigating adding log rotation to a future release.

@amdprophet amdprophet removed their assignment Mar 30, 2017
@amdprophet amdprophet removed the ready label Mar 30, 2017
@dzeleski
Copy link

@amdprophet Im not sure thats true. Im using the following xml config:

<!-- Windows service definition for Sensu -->
<service>
  <id>sensu-client</id>
  <name>Sensu Client</name>
  <description>This service runs a Sensu Client</description>
  <executable>C:\opt\sensu\embedded\bin\ruby</executable>
  <arguments>C:\opt\sensu\embedded\bin\sensu-client -d C:\opt\sensu\conf.d -L info</arguments>
  <logpath>C:\opt\sensu\</logpath>
  <log mode="roll-by-size">
        <sizeThreshold>10240</sizeThreshold>
        <keepFiles>10</keepFiles>
  </log>
</service>

My logs look like this:
Screenshot 1

In side the logs it looks like this:
Screenshot 2

Unless something is not being added in there (which is possible). I believe this is properly working.

@amdprophet
Copy link
Member

@dzeleski interesting - I wasn't using the logpath option but it seems like it is working. Have you had any issues with it removing the lock from the log files during rotation?

@amdprophet
Copy link
Member

@dzeleski I just noticed that your service definition doesn't include the -l path/to/sensu-client.log argument which means it's logging to STDOUT instead of having Sensu log out to a file. This is why log rotation is working for you. Logging to STDOUT on Windows may be a better option and I'll continue to look into using winsw's log rotation.

@dzeleski
Copy link

Yes correct, apologies should have mentioned that. There may be a better way that you guys can handle it within the app itself but this is at least working for us currently. I have no idea if there are pros and cons and I assume either way there would be some testing that would need to validate it.

@amdprophet
Copy link
Member

Sensu 0.29.5 will include changes that add log rotation. Thanks for the input @dzeleski!

@dzeleski
Copy link

dzeleski commented Apr 5, 2017

Awesome! Ty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants