Skip to content

nixos/logrotate: enable multiple paths per entry#152223

Merged
aanderse merged 2 commits intoNixOS:masterfrom
ju1m:logrotate
Jan 3, 2022
Merged

nixos/logrotate: enable multiple paths per entry#152223
aanderse merged 2 commits intoNixOS:masterfrom
ju1m:logrotate

Conversation

@ju1m
Copy link
Contributor

@ju1m ju1m commented Dec 26, 2021

Motivation for this change

Being able to use multiple paths per entry.

Things done
  • Change path from str to either str (listOf str), preserve backward-compatibility.
  • Use ExecStart= directly instead of script=.
  • Add internal name option.
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.05 Release Notes (or backporting 21.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Dec 26, 2021
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Dec 26, 2021
Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea 👍 Thanks!

@ju1m ju1m force-pushed the logrotate branch 2 times, most recently from 28bc851 to c83ef26 Compare December 28, 2021 23:42
@ju1m
Copy link
Contributor Author

ju1m commented Dec 28, 2021

Because of /var/log/{wtmp,btmp} existing by default and growing indefinitely over time, there's a case to be made about enabling services.logrotate.enable by default.

@aanderse
Copy link
Member

aanderse commented Dec 28, 2021

Because of /var/log/{wtmp,btmp} existing by default and growing indefinitely over time, there's a case to be made about enabling services.logrotate.enable by default.

It is a good point... but I think erasing your darlings is so trendy in our community you might get push back on that 😄

Might be worth pulling in some other opinions on that. I mentioned that our distro doesn't use logrotate enough a long time ago and did some initial work on the problem, but never took it very far.

@martinetd
Copy link
Member

Even erasing everything on boot doesn't get you close enough when some systems have years of uptime... which is bad in itself because no kernel update yes I agree but they still happen quite a bit of everywhere; I think it's orthogonal really. And if you didn't care that it wasn't here, you likely won't care either that it is here.

(I'm the one who brought up wtmp/btmp growing to @ju1m in the first place, thanks for this PR!)

To add a second point in favor of on-by-default, if services.logrotate.enable gets enabled by default I'll also add the few other paths I've noticed to the appropriate services (e.g. in services.nginx I'd add /var/log/nginx/*.log), but if it doesn't make it default I don't really see the point as people would likely not benefit from it: either they're enabling it themselves in which case they'll probably have the paths they need added or they don't and nothing happens.

Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR is good to go as it currently is without any further discussion. Once @ryantm approves we can click merge.

I like your idea to enable logrotate by default. This requires more discussion and we shouldn't hang this PR up on that discussion which might take a while...

Should we start a new discussion on discourse, etc... about enabling logrotate by default?

Copy link
Member

@ryantm ryantm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@ryantm
Copy link
Member

ryantm commented Jan 2, 2022

Here's some discussion about rotating these tmp files systemd/systemd#8295

Copy link
Member

@martinetd martinetd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is definitely good on its own without enabling by default, let's discuss that elsewhere :)

@aanderse
Copy link
Member

aanderse commented Jan 3, 2022

Thanks everyone!

@aanderse aanderse merged commit bf607ab into NixOS:master Jan 3, 2022
@ju1m ju1m deleted the logrotate branch January 3, 2022 20:48
@martinetd martinetd mentioned this pull request Feb 11, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants