nssm icon indicating copy to clipboard operation
nssm copied to clipboard

Rotate as soon as exactly one line is written

Open bjg2 opened this issue 5 years ago • 0 comments

Hey guys,

first of all, thanks for this very nice tool! It's been a great help.

Now, to my issue. I start x services, and I would like to see and process each their stdout / stderr line in another process as soon as it happens. This is the setup I tried with nssm:

AppStdout = `${this.consolePath}/stdout.log`
AppStderr = `${this.consolePath}/stderr.log`
AppRotateFiles = "1"
AppRotateOnline = "1"
AppRotateBytes = "1"

I don't want to have another process wrapping the service as it is just an overkill, I want to watch for the files that are stdout-XXX.log and stderr-XXX.log, as I know those will not change.

So, the problems that happen with this approach:

  1. Readme states On-demand rotations will happen after the next line of data is read, but that's not exactly true. I have files that are not lines, but have more than one line or split in the middle. For example:

stdout-20200324T110716.619.log:

    VendorId                                : 4318
    DeviceId                                : 6918
    SubSysId          

stdout-20200324T110716.620.log:

                      : 342890970
    Revision                                : 161
    DedicatedVideoMemory                    : 11667505152
    DedicatedSystemMemory        
  1. In theory, I might have more than one line in stdout / stderr for a given millisecond, which makes rotate files naming bad.

  2. Again, readme states On-demand rotations will happen after the next line of data is read, which means that last line is held in original file (like stdout.log) until new line is written. This is dangerous for me to read, as the file can change etc, I should read it when it is in stdout-xxx.log form. Is there a way to enable that rotation happens as soon as a line is written, not on the next line?

Thanks again for this great tool, really appriciate it! I'm aware I have very specific needs, but I guess behavior I need would be a great plus to the already great tool. Thanks!

bjg2 avatar Mar 24 '20 11:03 bjg2