Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to gzip log files. #314

Closed
ddan39 opened this issue Jan 23, 2015 · 7 comments
Closed

Option to gzip log files. #314

ddan39 opened this issue Jan 23, 2015 · 7 comments
Assignees
Labels
feature New feature request
Milestone

Comments

@ddan39
Copy link

ddan39 commented Jan 23, 2015

Just noticed my weechat logs are getting quite big, and figured I should gzip them to save space, but then thought maybe we can have weechat write to the files gzipped?

But is this even possible? By the nature of compression, I have a feeling it would not be, unless output is buffered and written in chunks... but I have no idea how gzip actually works :(

and on that note, maybe there is a better lib/algorithm for compressing a text stream?

Please & Thanks :)

@flashcode flashcode added the feature New feature request label Jan 23, 2015
@flashcode flashcode changed the title feature request: option to gzip log files, is it even possible? Option to gzip log files, is it even possible? Jan 23, 2015
@flashcode flashcode changed the title Option to gzip log files, is it even possible? Option to gzip log files. Jan 23, 2015
@HelixSpiral
Copy link
Contributor

If it isn't possible to gzip current logs, maybe just gzipping old ones would be fine. If you have logs set to rotate by day, week or month. When a new log file is made it can gzip the old ones.

@ghost
Copy link

ghost commented Mar 20, 2015

It should keep more than one ungzipped log file per buffer though, especially if logs are rotated by day. Maybe it could be a configuration option.

@highflyer77
Copy link

Maybe just have weechat read the compressed log files using: zcat like other applications do.

Using LOGROTATE(8) would simply handle this job. Logrotate is run as a daily cron job, and a user can set it up however they like.

@NoSuck
Copy link

NoSuck commented Aug 11, 2016

With ~500 MB of log data, I am interested in this possibility but would be concerned about losing the convenience of readily-available, universally viewable logs.

@ghost
Copy link

ghost commented Aug 11, 2016

Well, there is zcat and zgrep, and it could probably automatically (un-)gzip on next start if you change the option.

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@jeaye
Copy link

jeaye commented Nov 2, 2016

I have 2.0 GB worth of logs that're causing me some space issues right now, but I can't sacrifice the ability to easily search through them with /grep or similar plugins. Having weechat automatically compress these in a way that can be read via weechat would be superb, so this gets my 👍.

In the meantime, a fork of the grep plugin could likely be made to consider rotated, compressed files in its searching. That requires not only a custom plugin, but also a cron/systemd job for logrotating.

@flashcode flashcode self-assigned this Sep 26, 2022
@flashcode flashcode added the in progress Someone is working on this issue label Sep 26, 2022
@flashcode flashcode added this to the 3.7 milestone Sep 26, 2022
@flashcode flashcode removed the in progress Someone is working on this issue label Sep 28, 2022
@flashcode
Copy link
Member

flashcode commented Sep 28, 2022

Implemented with 3 new options:

  • logger.file.rotation_size_max: if set to something higher than 0, enables rotation with this file size is reached
  • logger.file.rotation_compression_type: compression of log files (none / gzip / zstd)
  • logger.file.rotation_compression_level: compression level (if compression is enabled)

For now the rotation is only based on log size, and we can still use filename masks to split logs by date, see: https://weechat.org/files/doc/devel/weechat_user.en.html#logger_filenames_masks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

6 participants