Commit Graph

149 Commits

Author SHA1 Message Date
ajs124
5bb61d6a25 syslogng_incubator: remove after being marked broken for over 18 months
It was marked in commit 6d797c8462 by Jörg Thalheim on 2018-08-27 (commited on 2018-08-27)
2022-06-02 18:03:52 +02:00
Janne Heß
57cd07f3a9
treewide: pkgs.systemd -> config.systemd.package
This ensures there is only one systemd package when e.g. testing the
next systemd version.
2022-05-05 20:00:31 +02:00
Nick Cao
70d0e24568 nixos/logrotate: use packages from buildPackages in configuration checkPhase, fixing cross compilation 2022-04-16 10:22:39 +02:00
Alyssa Ross
c099ec6aff nixos/klogd: remove
This module only has an effect for ancient kernel versions we don't
support.
2022-04-08 09:56:09 +00:00
Dominique Martinet
829c611b48 logrotate: add logrotate-checkconf.service
the build-time check is not safe (e.g. doesn't protect from bad users or nomissingok
paths missing), so add a new unit for configuration switch time check
2022-04-01 07:09:27 +09:00
Dominique Martinet
45ef5c1741 logrotate: add configuration check at build time
Now the service no longer starts immediately,
check if the config we generated makes sense as soon as possible.

The check isn't perfect because logrotate --debug wants to check
users required, there are two problems:
 - /etc/passwd and /etc/group are sandboxed and we don't have
visibility of system users
 - the check phase runs as nixbld which cannot su to other users
and logrotate fails on this

Until these two problems can be addressed, users-related checks
are filtered out, it's still much better than no check.
The check can be disabled with services.logrotate.checkConfig
if required
(bird also has a preCheck param, to prepare the environment
before check, but we can add it if it becomes necessary)

Since this makes for very verbose builds, we only show errors:
There is no way to control log level, but logrotate hardcodes
'error:' at common log level, so we can use grep, taking care
to keep error codes

Some manual tests:
───────┬──────────────────────────────────────────
       │ File: valid-config.conf
───────┼──────────────────────────────────────────
   1   │ missingok
───────┴──────────────────────────────────────────
logrotate --debug ok
grep ok

───────┬──────────────────────────────────────────
       │ File: postrotate-no-end.conf
───────┼──────────────────────────────────────────
   1   │ missingok
   2   │ /file {
   3   │    postrotate
   4   │      test
   5   │ }
───────┴──────────────────────────────────────────
error: postrotate-no-end.conf:prerotate, postrotate or preremove without endscript

───────┬──────────────────────────────────────────
       │ File: missing-file.conf
───────┼──────────────────────────────────────────
   1   │ "test" { daily }
───────┴──────────────────────────────────────────
error: stat of test failed: No such file or directory

───────┬──────────────────────────────────────────
       │ File: unknown-option.conf
───────┼──────────────────────────────────────────
   1   │ some syntax error
───────┴──────────────────────────────────────────
logrotate --debug ok
error: unknown-option.conf:1 unknown option 'some' -- ignoring line

───────┬──────────────────────────────────────────
       │ File: unknown-user.conf
───────┼──────────────────────────────────────────
   1   │ su notauser notagroup
───────┴──────────────────────────────────────────
error: unknown-user.conf:1 unknown user 'notauser'

In particular note that logrotate would not error on unknown option
(it just ignores the line) but this change makes the check fail.
2022-04-01 07:09:27 +09:00
Dominique Martinet
e92c05349c nixos/logrotate: convert to freeform
using freeform is the new standard way of using modules and should replace
extraConfig.
In particular, this will allow us to place a condition on mails
2022-04-01 07:09:26 +09:00
Dominique Martinet
3cc8ea28d1 logrotate: add services.logrotate.configFile escape hatch 2022-04-01 07:09:26 +09:00
Dominique Martinet
3a2fa0d049 logrotate: run through nixpkgs-fmt
Running once now will make further patches formatting easier
2022-04-01 07:09:26 +09:00
Dominique Martinet
b457d917dc logrotate: move mail dependency from package to service
having pkgs.logrotate depend on mailutils brings in quite a bit of dependencies
through mailutil itself and recursive dependency to guile when most people
do not need it.

Remove mailutils dependency from the package, and conditionally add it to the
service if the user specify the mail option either at top level or in a path

Fixes #162001
2022-04-01 07:09:24 +09:00
Pascal VITOUX
045b819959 nixos/graylog: fix group creation
As described in #163571, the graylog group was not created by the
module.
2022-03-14 10:13:15 +01:00
Dominique Martinet
4d12b79cd7 logrotate: do not enable logrotate.service itself
logrotate.timer is enough for rotating logs. Enabling logrotate.service would
make the service start on every configuration switch, leading to tests failure when
logrotate is enabled.

Also update test to make sure the timer is active and runs the service
on date change.
2022-02-26 19:13:12 +09:00
Dominique Martinet
c132bfaa19 logrotate: prepend extraConfig instead of postpending it
logrotate global options only affect rules following them - as such,
services.logrotate.extraConfig being added last makes the option only
useful for adding new paths but not for setting global options (e.g.
'dateext' so all logs are rotate with a date suffix).

Moving this first solves this problem, and we can then use this instead
of default paths config to append missingok/notifempty.
2022-02-11 21:07:37 +09:00
Dominique Martinet
61c70dbc97 logrotate: default to enable if any rule is active 2022-02-11 21:07:37 +09:00
Dominique Martinet
9917af7fe0 logrotate: move wtmp/btmp rules to systemd
wtmp and btmp are created by systemd, so the rules are more appropriate there.

They can be disabled explicitly with something like
  services.ogrotate.paths = {
    "/var/log/btmp".enable = false;
    "/var/log/wtmp".enable = false;
  };
if required.
2022-02-11 20:52:40 +09:00
Linus Heckemann
3e4ce97430 nixos/promtail: use promtail package 2022-01-23 14:01:29 +01:00
Julien Moutinho
f7ff512d6d nixos/logrotate: rotate login/logout logs by default 2021-12-29 02:07:02 +01:00
Julien Moutinho
c2fd94a61c nixos/logrotate: enable multiple paths per entry 2021-12-28 21:23:46 +01:00
Graham Christensen
06edb74413
Merge pull request #148785 from pennae/more-option-doc-staticizing
treewide: more defaultText for options
2021-12-17 11:14:08 -05:00
Kim Lindberger
ebaa226853
elk7: 7.11.1 -> 7.16.1, 6.8.3 -> 6.8.21 + add filebeat module and tests (#150879)
* elk7: 7.11.1 -> 7.16.1

* nixosTests.elk: Improve reliability and compatibility with ELK 7.x

- Use comparisons in jq instead of grepping
- Match for `.hits.total.value` if version >= 7, otherwise it always
  passes
- Make curl fail if requests fails

* nixos/filebeat: Add initial module and test

Filebeat is an open source file harvester, mostly used to fetch logs
files and feed them into logstash.

This module can be used instead of journalbeat if used with
`filebeat7` and configured with the `journald` input.

* python3Packages.parsedmarc.tests: Fix breakage

- Don't use the deprecated elasticsearch7-oss package
- Improve jq query robustness and add tracing

* rl-2205: Note the addition of the filebeat service

* elk6: 6.8.3 -> 6.8.21

The latest version includes a fix for CVE-2021-44228.

* nixos/journalbeat: Add a loose dependency on elasticsearch

Avoid unnecssary back-off when elasticsearch is running on the same
host.
2021-12-17 00:20:52 +09:00
pennae
70b105d1d0 nixos/journalbeat: remove support for versions < 6
nixos no longer ships journalbeat 5 and hasn't since at least 20.09. remove
checks for older versions from the module.
2021-12-08 21:41:18 +01:00
pennae
2512455639 nixos/*: add trivial defaultText for options with simple defaults 2021-12-02 22:35:04 +01:00
Aaron Andersen
f366af7a1b
Merge pull request #136630 from mweinelt/logrotate-hourly
nixos/logrotate: allow hourly frequency
2021-11-29 07:42:14 -05:00
Niklas Hambüchen
f692dc62c8 nixos/logstash: Add logstashJvmOptionsFile option 2021-11-01 16:21:02 +01:00
Naïm Favier
2ddc335e6f
nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
Guillaume Girol
fa3664a176 nixos/logcheck: define group, fix after #133166 2021-09-18 14:42:08 +02:00
Guillaume Girol
3592034595
Merge pull request #133166 from symphorien/nonogroup
Don't default to nogroup for the primary group of users.
2021-09-13 18:29:21 +00:00
Guillaume Girol
bc3bca822a nixos: define the primary group of users where needed 2021-09-12 14:59:30 +02:00
Martin Weinelt
27b571067e
nixos/logrotate: allow hourly frequency
Also adjust the timer to run with the hourly keyword.
2021-09-10 14:17:20 +02:00
Zhaofeng Li
b6ad701a2c nixos/promtail: Allow write access to positions file if not in CacheDirectory
Because of `ProtectSystem=strict`, Promtail cannot write to the positions
file if it's not in its `CacheDirectory` (the default value).
2021-08-25 22:54:39 -07:00
Martin Weinelt
de5a69c918
nixos/promtail: Set TimeoutStopSec=10
On reboots and shutdowns promtail blocks for at least 90 seconds,
because it would still try to deliver log messages for loki, which isn't
possible when the network has already gone down.

Upstreams example unit also uses a ten seconds timeout, something which
has worked pretty well for me as well.
2021-04-28 21:02:11 +02:00
happysalada
d434251d1c vector: remove deprecated --no-topology 2021-04-05 08:30:52 +09:00
happysalada
bb7da110d1 vector: format with nixpkgs-fmt 2021-04-05 08:30:12 +09:00
Sandro
7d0dad76ef
Merge pull request #116936 from hercules-ci/logstash-jdk 2021-03-30 17:22:21 +02:00
Linus Heckemann
22de3c19e7 graylog: improve JRE handling
Since the upstream graylogctl script will prefer finding its java
executable based on JAVA_HOME, we now set this instead of PATH in
order to allow it to find the JRE. By setting it conditionally on it
not already being set, we allow selecting a different JRE at runtime.

We also explicitly use openjdk11, which supports the
UseConcMarkSweepGC option which graylog insists on using.
2021-03-28 14:37:28 +02:00
Robert Hensing
e7e6e8d5c3 nixos/logstash: Don't set unnecessary JAVA_HOME 2021-03-23 14:42:40 +01:00
volth
bc0d605cf1 treewide: fix double quoted strings in meta.description
Signed-off-by: Ben Siraphob <bensiraphob@gmail.com>
2021-01-24 19:56:59 +07:00
happysalada
627dfecadd nixos/vector: add module 2020-11-30 16:22:08 +09:00
Jörg Thalheim
31a0b5dff6
nixos/promtail: fix access to journal 2020-11-10 10:49:27 +01:00
Jörg Thalheim
88d1da8e5d
nixos/promtail: use json type for configuration 2020-11-10 10:49:23 +01:00
Janne Heß
54217cac69
nixos/promtail: Add a promtail module 2020-11-03 14:36:56 +01:00
Lassulus
d8e671676d
Merge pull request #89785 from buckley310/logstash
logstash: fix support for multiple plugin paths
2020-08-22 14:07:20 +02:00
Silvan Mosberger
1b8a94db67
nixos/logrotate: Fix option reference
Fixes the manual build
2020-08-22 01:38:38 +02:00
Aaron Andersen
00f08005af nixos/logrotate: switch paths option type from listOf to attrsOf 2020-08-21 17:04:04 -04:00
Sean Buckley
ebc2067bc5 logstash: fix support for multiple plugin paths 2020-06-08 00:04:15 -04:00
Jeff Slight
fe07adef7f
nixos/logrotate: add newline before extraConfig
Co-authored-by: Ryan Mulligan <ryan@ryantm.com>
2020-05-13 20:52:26 -07:00
Jeff Slight
90ce7f508a nixos/logrotate: add options for basic paths 2020-05-13 13:44:58 -07:00
Jeff Slight
c94911c5b7 nixos/logrotate: use lib.mkEnableOption 2020-05-13 11:58:51 -07:00
Izorkin
9f099143bc nixos/awstats: change path to nginx logs 2020-05-04 16:36:38 +03:00
rnhmjoj
1d61efb7f1 treewide: use attrs instead of list for types.loaOf options 2020-01-06 10:39:18 -05:00