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

[ENHANCEMENTS] Logrotation / Compression #411

Open
Morethanevil opened this issue Dec 3, 2024 · 8 comments
Open

[ENHANCEMENTS] Logrotation / Compression #411

Morethanevil opened this issue Dec 3, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@Morethanevil
Copy link
Contributor

This enhancement shall save storage space. I took a look at the logs, and it seems Zoraxy does not compress them, they get bigger over time. No rotation, just archiving. On my homeserver they are 300MB, but on my main server the log folder it was over 15GB :)

Maybe Zoraxy could compress them with zip or tar. An option in the settings to delete them after X days would be an idea too.

Screenshot 2024-12-03 232545

@Morethanevil Morethanevil added the enhancement New feature or request label Dec 3, 2024
@tobychui
Copy link
Owner

tobychui commented Dec 3, 2024

@Morethanevil Wow your homelab is really handling some big traffics.
I am currently planning to reconstruct the whole statistic system with some other faster DB (LevelDB maybe?) so more details can be seen on the statistic analysis & system logger. I could optimize the log file management logic together with this update.

@Morethanevil
Copy link
Contributor Author

That would be cool. An option to delete logs after a month or x days would be cool too.

My main server handles a lot of traffic because it federates with others. Mastodon, Sharkey, Lemmy, Matrix etc... This is normal for me 😄

Most logs by nginx or apache are compressed via tar.gz, maybe Zoraxy could use this too. The newest way in Linux are binary logs (journalctl)

Just a few thoughts

@LeonardoIz
Copy link

Related to this, it would also be good to add an option that automatically cleans the logs every so often.

@barto95100
Copy link

Yes the same and possibility button to clear all file or listed file :
image

@flymia
Copy link

flymia commented Dec 29, 2024

@Morethanevil In the meantime, you could setup a custom logrotate rule to handle this. Other reverse proxies/web servers also use logrotate to do that kind of stuff.

Since Zoraxy does not install into default locations and everything is handled in one main directory, writing a logrotate rules and shipping them with Zoraxy is extremely difficult. I would have made a pull request already, but the fact that Zoraxy stores logs in it's own directory and there is (as far as I know) no way to change it, every setup is too custom.

@tobychui
Copy link
Owner

@flymia The Zoraxy logger module do have a parameter for setting the output log location, but I didn't expose it as I didn't thought of this will be necessary. If exposing such interface will make your change / PR easier, please feel free to let me know (with details on what changes can benefit your implementation the most). For easy changes like this, I probably can implement and ship it in the next release :)

@flymia
Copy link

flymia commented Dec 29, 2024

@tobychui Basically what's missing is an option to set the various paths (not only log). So it would be a fantastic if we could have an option to setup the paths how we want them to be.

This is my zoraxy folder today. I installed it in /opt/zoraxy:

ls -l /opt/zoraxy/
total 130M
drwxr-xr-x. 7 root root  118 Dec 10 13:00 conf/
drwxr-xr-x. 2 root root   28 Dec 10 13:00 log/
-rw-------. 1 root root 132K Dec 29 00:00 sys.db
-rwxr-xr-x. 1 root root   36 Dec 10 13:00 sys.uuid*
drwxr-xr-x. 2 root root   48 Dec 17 10:37 tmp/
drwxr-xr-x. 4 root root   35 Dec 10 13:00 www/
-rwxr-xr-x. 1 root root 130M Nov 24 08:04 zoraxy*

It would be great to set it up in the way, that I can put the directories into the FHS ones, if running natively on the machine (and not in a docker container).

  • conf -> /etc/zoraxy
  • log -> /var/log/zoraxy
  • tmp -> /var/tmp/zoraxy
  • www -> /var/www/html (or something like that)

That way I could also make another pull request to setup SELinux policies and build an RPM package that users can use to install it faster and easier natively on their Red Hat based machines. Plus, I can put the systemd service file in the RPM, so that this is also done automatically. Since zoraxy is already running as root, file system permissions are not a big problem.

@flymia
Copy link

flymia commented Dec 30, 2024

Oh, and I forgot to mention: We also would need to change the location of the database file and sys.uuid file. IMO, the FHS compliant folder for that would be /var/lib/zoraxy.

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

No branches or pull requests

5 participants