ServerLogSaver
ServerLogSaver
Description
Simply put, this will backup the server.log file to a directory, and then clear the existing server.log file. This is to reduce RAM usage of the server host and effectively reduce lag for server players.
Most of the functions in this are configurable, such as backup location, time delay between backups, choice of Size and Time rotations and more!
Download the Jar
- ServerLogSaver v2.1.1
- ServerLogSaver v2.1.0
- ServerLogSaver v2.0.2
- ServerLogSaver v2.0.1
- ServerLogSaver v2.0
Download the Source
Old Source ServerLogSaver src v0.1b
Commands
- /sls copy
- /sls zip
Current Features
- User defined time for backup intervals (default time is 1 day, 1440 minutes)
- Backups are time stamped for ease of use
- Compress the logs
- Check for 0 byte content
- Console notice (optional)
- Choice of time/size/restart rotations (Time in minutes/Size in KB/Restart only backs up on server start)
- User defined backup storage location
- User defined backup file names (prefix and time setup)
- In-game command to do backups on will
- Choose the number of logs to keep before purging
To-Do
- Record commands used in a separate file (Probably make a separate plugin for this)
- need more ideas, feed back would help :D
Change-Log
Version 2.1.1
- Updated to 1.2.5 R4.0
Version 2.0.2
- No longer backs up as soon as the server starts with 'time' rotation
Version 2.0.1
- Added 'restart' rotation choice
Version 2.0
- Complete re-code
- Added in-game commands
- Updated to latest config
Could you please change the way it works ? If I restart the server so It won't start a new file and still writes to it unless the day is over ?
I see you've added custom backup locations -- what does this path relate to? I tried '../../logs', to save the backups in the logs dir at the root of the server, but this didn't seem to work.
The new version works fine. The only thing that annoys me is that, if compression is on, it makes a new zip for every log file. Would it not be possible to instead make a archive for every day and then put every single log file for that day into that archive?
@ScavyDK
FYI, new version is out, added the features you recommended. Hope you use it!
Finished! New version includes customizable backup locations, backup name prefixes and backup name time layout. Wooo, thats a mouthful. xD
@ScavyDK
I'm currently working on adding user defined backup locations, but it is proving to be a it hard as i can't seem to get Strings out of the config properly. I will have it done soon however.
Also, that also may be something to add, customizable file names, although i can see several problems arising if people do not use proper formats. Ill find a way.
:)
Is it possible to select where to place the logs? Like if I want the logs copied to a subdirectory of the main folder instead of the plugin folder. I want to keep plugins and logs separate.
And is it possible to customize the filename? Like this: serverlog-YYMMDD-HH-MM-SS.log
@GameCharmer
Wow, that is a good idea. I'll get to work on adding that in over the next week. Since I'm still new to all this ill need to learn it all.
[EDIT]: After some careful consideration, I decided not to do this as it would not be what I had set out to design but another plugin altogether. Maybe it could be just that, another plugin.
Well, since you are asking for ideas, how about reading each line of the log and storing it in a MySQL database? That way I could hit up my logs via a PHP frontend and never have to connect to the physical machine. :)
Actually, I would LOVE this mod if it could do this.
Released v1.0 now! Any bugs, please report
Version 0.2.1b out. Only new feature is zip configuration.
Next version will include
Im just goin to do 2 different methods, one with compression, one without. If the config is set to zip then it does the zip method, else it does the normal method, if you understand that.
Ah, gotcha. Even better, have the config line designed where one can specify the compression program to use, with flags if at all possible. I'm not a coder, but I would be surprised if java didn't have a way to make a call to a system binary.
It automatically compresses the logs, no configuration needed. As i said, i may make it configurable later, and since you seem to want it, ill get started on it now.
Just installed the 0.2b, and the config file is unchanged (AKA I'm not seeing the option to compress the logs). Am I missing something? :-)
@Malific
Alright, I agree with you and jcynical now that i fully understand what he means. Next version I will make it configurable so as you choose what method you wish to save by, be it Time based or Size based.
But for this newest version I have added file compression (which i may make configurable later), and 0 byte checking.
Again, thank you for the much needed feed back and ill get to work on doing it size based ASAP.
I Agree with jdcynical.
Being able to back up based on server.log file size rather than a set time would be great.
I run a small server and note much happens on it, but I'd like to switch my log out every 1-2mb just to make it easier to parse through.
@LaserHog
Rotating logs based on size. As the plugin is currently designed, it will rotate the server.log file every $TIME. If one of the ideas is to keep the server from dealing with a huge log file, there isn't any point of rotating and archiving it if it's not big enough. Granted, I'm sure the actual process of the rotation isn't very system intensive, but every little bit helps.
I will get to work on adding:
For the next release which will be version 0.2b
Thanks to everyone for the feed back and i hope to make this as useful and user friendly as possible for you.
Don't get me wrong, this plugin does help with lag which is great. It's just the RAM part that confused me because I couldn't find any difference in useage.
I'll definitely give this a try though. Can't wait for when you get the purging, compression and checks for 0 byte content in place. :)