MinimServer Forum

Full Version: Is it possible to quasi-rotate minimserver.log?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

Minimserver 0.8.5.3, Intel Synology NAS.

Following this tip - https://forum.minimserver.com/showthread.php?tid=5197 - I am developing a wee program to list tracks played and offer them up for rating at leisure later. I'm essentially grepping GET /minimserver/...-type lines from the log.

However, because this method relies on the Debug level of logging, the log file gets large very quickly.

It seems that the log visible in MinimWatch is not strictly the one written to the default minimserver.log in the appData directory. If I try to 'prune' this latter log by discarding all lines up to the last GET statement, for example (I tried using sed), it is broken and fails to update thereafter, although the log in MinimWatch remains functional. If I simply delete minimserver.log, it is replaced and becomes functional upon restart.

So I don't seem to be able to manipulate the logging file with a bash script without recourse to MinimWatch. If I upgrade to MinimServer 2, will this be possible? Are there any other ways to automate the occasional clearing or cleaning of the log file?
Deleting the log file should not require a restart to make logging start again. I will check this.

You should be able to copy the log file, then delete it, then grep the copy you have made, then delete the copy.
(30-10-2020 23:09)simoncn Wrote: [ -> ]Deleting the log file should not require a restart to make logging start again. I will check this.

You should be able to copy the log file, then delete it, then grep the copy you have made, then delete the copy.

You may well be right about the restart. I didn't do an exhaustive one-thing-at-a-time test. And your solution makes perfect sense.

I wonder if MS2 has the option to fork off elements of the log in the manner that minimserver-out.log contains start/running info? If we could have GETs written to their own log (with a full date, please, so we don't have to guess these from recent 'MinimServer ... is running' lines) then I'd be in clover!

My gratitude, as always, for this excellent product and support.
The debug log output is intended for debugging only. You can use it for other purposes but this not a supported feature of MinimServer. It is not practical to split this output into different types of output going to different destinations. Fortunately there are tools such as grep that can do this.

If you want each log line to have a full date and time, you can set the .logPrefix property to dateTime. For a list of supported .logPrefix values, see this section.

Edit: The above statement isn't correct. See this post.
Roger that, re multiple logs...

Regarding getting the full date for 'GET ...' lines in minimserver.log, it seems you may have overlooked the effect of specifying Verbose logging, necessary to get these lines printed in the first place. I think you explained last time that the milliThread setting takes over for Verbose logging, regardless of the .logFile setting. We chatted about this last month: https://forum.minimserver.com/showthread.php?tid=5852. I already have dateTime as my .logFile setting.

Quentin in Suffolk
... sorry, I meant to say, "I already have dateTime as my .logPrefix setting."
My apologies for giving incorrect information. You are correct that the dateTime setting is ignored for Debug and Trace (not Verbose) logging.
Reference URL's