Soma Posted June 15, 2018 Share Posted June 15, 2018 LogMaintenance A simple ProcessWire module to give some maintenance control over log files. I found myself often having lots of log files for different things that can grow more or less quickly to a size where they can be difficult to maintain. The built in Logger of PW does a good job of giving you the possibility to delete or prune logs. But it has to be done manually and sometimes a log grows into millions of lines, which makes it often impossible to even prune it as it's too large. LogMaintenance uses LazyCron to run the maintenance task and there's several settings you can setup on a global or per log basis. Archive: will create zip files for each log file in logs/archive/ folder and add the log each time the maintenance is run to a subfolder containing the datetime. Lines: keeps logs to a certain number of lines Days: keeps the log to a certain number of days Bytes: keeps the log to a certain amount of bytes Each setting is checked from top down, the first setting to contain something is used. So if you check the "Archive" option, all other settings are ignored and logs are archived everytime the LazyCron is executed. If you want to keep your logs to a certain amount of bytes just leave all other settings to 0 or blank. Per Log Settings There's a textarea that you can use to setup a config for a specific log file one per line. All the logs you define here ignore the global settings above. The syntax for the settings is: logname:[archive]:[lines]:[days]:[bytes] errors:1:0:0:0 // would archive the errors log messages:0:10000:0:0 // will prune the errors log to 10000 lines The module can be found on github for you to check out. It's still fresh and I'm currently testing. https://github.com/somatonic/LogMaintenance 18 1 Link to comment Share on other sites More sharing options...
szabesz Posted June 15, 2018 Share Posted June 15, 2018 This is great! Thanks a million for sharing! Link to comment Share on other sites More sharing options...
wbmnfktr Posted July 10, 2018 Share Posted July 10, 2018 Just... ?? Link to comment Share on other sites More sharing options...
Robin S Posted August 20, 2019 Share Posted August 20, 2019 Hi @Soma, Could you please add this very useful module to the PW modules directory? Thanks! 4 Link to comment Share on other sites More sharing options...
ceberlin Posted March 17, 2021 Share Posted March 17, 2021 Can be an essential element of a GDPR data protection strategy. Very useful. Thank you! Link to comment Share on other sites More sharing options...
ceberlin Posted March 17, 2021 Share Posted March 17, 2021 Maybe a bug: I cannot set "Bytes" in the module settings to anything else than 0 - It resets to "0" after saving. Link to comment Share on other sites More sharing options...
wbmnfktr Posted June 23, 2021 Share Posted June 23, 2021 Thanks again for this little helper, @Soma! Link to comment Share on other sites More sharing options...
tcnet Posted January 6, 2023 Share Posted January 6, 2023 This module has several bugs. Line 113 must be: if($archive == '1') { Line 159 must be: if($this->archive == '1') { Line 295 must be: $field->attr('name', 'bytes'); Forked here:https://github.com/techcnet/LogMaintenance 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now