Giter Site home page Giter Site logo

Comments (10)

JackDotJS avatar JackDotJS commented on September 1, 2024

Forgot to mention, this should also apply to the profile backups thing I mentioned here: #12 (comment)

from optibot.

JackDotJS avatar JackDotJS commented on September 1, 2024

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.

JackDotJS avatar JackDotJS commented on September 1, 2024

Still relevant for NX. Log files pile up like crazy, at least in a development environment.

from optibot.

JackDotJS avatar JackDotJS commented on September 1, 2024

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.

JackDotJS avatar JackDotJS commented on September 1, 2024

mostly done, still need to delete year old archives (both profiles and logs, actually)
will do this later

from optibot.

JackDotJS avatar JackDotJS commented on September 1, 2024

added in 5bb6f87.
will keep open for a later update

from optibot.

bdotsamir avatar bdotsamir commented on September 1, 2024

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.

JackDotJS avatar JackDotJS commented on September 1, 2024

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.

JackDotJS avatar JackDotJS commented on September 1, 2024

still todo: delete year old archives

from optibot.

JackDotJS avatar JackDotJS commented on September 1, 2024

more todo: backup new guild configs (#285)

from optibot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.