bugy / script-server

Web UI for your scripts with execution management
Other
1.52k stars 244 forks source link

Logging file creation #623

Open oron89 opened 1 year ago

oron89 commented 1 year ago

Hello @bugy and all,

I saw this logging configuration - https://github.com/bugy/script-server/wiki/Server-configuration#--execution_file

Each execution is always written to a separate file

However, is there any way to change the frequency of file creation without editing the base code? For example, file creation by a combination of script name and day (log file per script per day, instead of log file per execution).

Thank you!

MNeill73 commented 1 year ago

This may be easier to do by way of a crontab that runs just after midnight each day...

#!/bin/bash
cd /path/to/your/scriptserver/logs

ydate=`date -d "yesterday" +"%y%m%d"`
logfile="Scriptserver-unified-${ydate}.log"; rm ${logfile}

for logfile in `ls -tr *${ydate}*.log`; do cat $i >> ${logfile} && rm $i; done

Then we could either add ${logfile} to the list of files parsed for display by the UI, or you can write another script to find those files, and load it into Scriptserver to display those files.