Comments (10)
Forgot to mention, this should also apply to the profile backups thing I mentioned here: #12 (comment)
from optibot.
As suggested by @sp614x, we could zip a group of logs first, and then delete them later.
What I could do is take logs and group them by each month they were generated in. These zipped files could be moved into a separate "archive" folder, where they can then be deleted like a year later.
from optibot.
Still relevant for NX. Log files pile up like crazy, at least in a development environment.
from optibot.
honestly, i've been putting this off for so so long, it's unbelievable. frankly it's mostly because i dread trying to imagine how this would be programmed. doing stuff with the file system is NOT fun, but i think i've finally figured out how this could be done in a relatively simple manner:
rather than on EVERY startup, log archiving should be done at the start of each month (simply check if date === 0
during boot). at the start of each month, the bot can search through the entire logs folder and group each log file by their month and year. these files can then be archived as <month> <year>.zip
(or 7z if possible). as a fail-safe, the bot will ignore all files that were created on the current month and year. additionally (probably after emptying the logs folder), the bot can go through the archive folder and deleted archives that are exactly over a year old.
as for getting the file ages/dates, i'm still considering whether this should check the actual file metadata or the file name. the file names would likely be more reliable, but they're too easy to manipulate. file metadata, on the other hand, will ALWAYS give some kind of valid date, but it is incredibly unreliable in my experience.
alternatively, i could just check both and pick the oldest date. idunno
from optibot.
mostly done, still need to delete year old archives (both profiles and logs, actually)
will do this later
from optibot.
added in 5bb6f87.
will keep open for a later update
from optibot.
This isn't difficult, I implemented it myself, check it out: https://gitlab.com/akii0008/lwbot-rewrite/-/blob/master/src/startup.js#L110
from optibot.
from #223:
the only potential issue i see with the current design is that any crash that happens right at the end of the month can only be viewed by accessing the archive manually, assuming they're being looked at on or after the first day of the next month. a potential solution to this may be to only archive files once they are over a month old, instead of archiving ALL files within a given month after that month has passed.
side note: this can probably be done with relatively minimal changes to the current script, but it will require running the script every day on startup, which can (and will) increase the overall boot/restart time.
from optibot.
still todo: delete year old archives
from optibot.
more todo: backup new guild configs (#285)
from optibot.
Related Issues (20)
- Have OptiBot ignore modpinging mods with the 'On Vacation' role
- !rr - Russian roulette minigame HOT 4
- More options for !exec HOT 1
- Expanded dev environment settings in config.json HOT 1
- Final Warning HOT 2
- If a time is not set for a ?mute, check with moderator first if they meant to leave the time empty HOT 4
- [Fun] @everyone Wheeze reaction HOT 9
- [Suggestion] Add ability to record user alts HOT 1
- Remove OptiFine dependency
- Per-guild Configs HOT 3
- Guild-exclusive commands
- Auto Commands: Replacement system for OptiBits
- Replace all *sync() fs methods with promises
- Hardcode so bots can not ban users with similar permissions. HOT 2
- Various enhancements for !role
- Add whitelist/blacklist toggle for channel logging to config
- ?delnote is unable to delete records if they are the first in the user's record
- idea: change server from windows to linux-based HOT 4
- Change around the way perms work? HOT 4
- !idcode - Identify unicode characters
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from optibot.