Closed Bisa closed 8 years ago
Some support for this in init scripts sounds interesting, but don't you think that something like logrotate would be better for larger / more permanent servers?
fair point, I guess I didn't look into logrotate enough to know that it could detect a server restart to save the logs before factorio overwrites them - or am I missing something?
(ps, awesome game - keep up the good work)
Actually:
logrotate is designed to ease administration of systems that generate large numbers of log files. It allows automatic rotation, compression, removal, and mailing of log
files. Each log file may be handled daily, weekly, monthly, or when it grows too large.
Normally, logrotate is run as a daily cron job. It will not modify a log multiple times in one day unless the criterion for that log is based on the log's size and logro‐
tate is being run multiple times each day, or unless the -f or --force option is used.
This would not help if Factorio was restarted say once every day on a schedule (not that it would need to since the game is remarkably stable)...
I'm not sure how I would solve ths, I've been thinking it'd be nice with some more retention other than just the current and previous logs but thinking about it I find loop holes in my initial idea; What if the server is restarted 5 times in quick succession (testing some mod configs or such), that would wipe out at least 5 older logs if they were rotaded/retained in one file per session - might want to concatenate them or soemthing and now it starts being a bit of a complex task =P
You're right. But we (I'm a dev :-) ) could add a commandline flag to Factorio so that doesn't rotate logs automatically. That would help, right? The rest of the job would then be up to logrotate.
that would simplify things for sure, then logrotate would make a lot more sense yes
hey @bluecube - did you add this to your todo list internally? (I know u guys are super busy with 0.13 and I wouldn't request it to be added sooner than when you feel you have the time to prioritize it just giving you a poke to ensure it's not forgotten ;)
Hi, thanks for reminding me, I almost forgot :-). The change is ready and will be part of the 0.13.0 release.
Sweet, good luck with the finishing touches on 0.13 - u guys are doing an awesome job, keep it up =)
@bluecube Even if this issue is closed, having Factorio daemon to handle HUP signal and then closing/reopening the log file will ease the setting of logrotate.
This will allow log file rotation without downtime or without logrotate tricks (copy/truncate).
@damajor I no longer work at wube, so I can't really help you with that. But yes, this sounds like a very reasonable change :-)
Factorio as it is today stores 2 logs, one "current" and a previous log.
I've been wanting to add a feature that would rotate/retain logs on a server graceful shutdown to store more than 2 restarts' worth of logs.