2

I use NSSM to install and start my Windows services. Also I am trying to rotate log files by size and limit their number. Rotation by size was implemented, but I can not limit number of files.

Issue is that for a few time in log directory will be too many log files and this directory could become too large.

Currently I use this code to configure logs

nssm install SERVICE_NAME %FC_WEB_BAT%
nssm set SERVICE_NAME AppStdout "%OUTDIR%\logs\SERVICE_NAME\service.log"
nssm set SERVICE_NAME AppStderr "%OUTDIR%\logs\SERVICE_NAME\service-error.log"
nssm set SERVICE_NAME AppStdoutCreationDisposition 4
nssm set SERVICE_NAME AppStderrCreationDisposition 4
nssm set SERVICE_NAME AppRotateFiles 1
nssm set SERVICE_NAME AppRotateOnline 1
nssm set SERVICE_NAME AppRotateSeconds 0
nssm set SERVICE_NAME AppRotateBytes 100
nssm start SERVICE_NAME 

Is there way to say NSSM that I want to store only the N newest files?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Aleksandr
  • 21
  • 2

0 Answers0