Skip to content

[enhancement] ArchiveHandler: log compression #692

Open

Description

@bengaywins

I don't really understand why it wasn't built in, but this handler should compress the old logs.

6.9G Dec 29 11:47  archive.log.2017-12-27
394M Dec 29 11:47  archive.log.2017-12-27.gz

Having a log this size uncompressed, and more than one, is just pointless and dumb. This is the perfect candidate for compression from this large number to a significantly smaller number. As one sees with the same file compressed with the highest compression (-9) above in gzip.

Activity

  1. DStape commented on Mar 21, 2018

    @DStape
    Contributor

    Hi @gehzumteufel,

    Looking at the ArchiveHandler code, it looks like it does some kind of rotation using Python's logging.handlers.TimedRotatingFileHandler. When instantiating, the handler code passes an encoding. By default, this is empty but it can be configured as part of the handler's config.

    Could you try setting encoding = bz2 in the config and see if that works? Thanks.

  2. DStape commented on Mar 21, 2018

    @DStape
    Contributor

    (Just to note, encoding is listed as a config option in the documentation (https://diamond.readthedocs.io/en/latest/handlers/ArchiveHandler/), but maybe we should update that to include examples to make what it does more obvious.

  3. bengaywins commented on Mar 26, 2018

    @bengaywins
    Author

    @DStape I am not in an environment where I have to worry about this right now (or am even using it for the moment), but @jasonhancock may be able to test it as he is in the same environment I was in still. He's definitely got some logs he could use this on.

  4. jasonsattler commented on Apr 30, 2018

    @jasonsattler

    Looks like the encoding option worked. I think just adding a quick description and valid values would help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions