Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cff-version: 1.2.0
title: 'eb-keep-logs: keep failed EasyBuild logs and rotate pipeline logs'
message: If you use eb-keep-logs, please cite it using the metadata below.
type: software
authors:
- given-names: Rohit
family-names: Goswami
email: rgoswami@ieee.org
orcid: https://orcid.org/0000-0002-2393-8056
license: MIT
repository-code: https://github.com/stackhands/eb-keep-logs
url: https://stackhands.github.io/eb-keep-logs/
keywords:
- EasyBuild
- logs
- HPC
- Lmod
- XALT
abstract: Keeps a failed EasyBuild build's logs, command output and meson testlog,
rotates a pipeline log tree, and in the Zig build also reports build failures
and software usage from XALT and Lmod records.
2 changes: 1 addition & 1 deletion COMPAT.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on the same invocations.

| | |
|---|---|
| commands | `failed STATUS NAME LOGDIR [TMP_LOGDIR]`, `rotate ROOT --compress-after DAYS [--delete-after DAYS] [--dry-run] [--lock-timeout SECONDS]`, `-h`, `--help`, `--version` |
| commands | `failed [--syslog TARGET] [--metrics-file PATH] STATUS NAME LOGDIR [TMP_LOGDIR]`, `rotate [--syslog TARGET] [--metrics-file PATH] ROOT --compress-after DAYS [--delete-after DAYS] [--dry-run] [--lock-timeout SECONDS]`, `-h`, `--help`, `--version` |
| usage | the same text on stdout for `-h`, `--help` and no arguments |
| exit codes | 0 on success and on every `failed` that got past its arguments; 2 for a refused invocation, after `eb-keep-logs: MESSAGE` on stderr; 2 with the usage text on stdout for no arguments; 75 when another `rotate` holds ROOT's lock past `--lock-timeout`, after `eb-keep-logs: another rotate holds the lock ROOT/.eb-keep-logs-rotate.lock; gave up after N s (--lock-timeout)` on stderr |
| one rotate at a time | `rotate` holds an exclusive flock(2) on `ROOT/.eb-keep-logs-rotate.lock`, created when missing, from before it reads ROOT until it exits; it waits up to `--lock-timeout` seconds for it, 600 without the option or with an empty value, 0 not at all, 999999999 at most; it opens the file for reading when it may not write it; a lock file that cannot be opened, or a symbolic link or non-regular file at its name, is refused, exit 2; on a file system that cannot lock, `rotate` says so on stderr and rotates without the lock |
Expand Down
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ sha256sum --check --ignore-missing SHA256SUMS
install -m 0755 "eb-keep-logs-$v-$arch-linux-musl" ~/.local/bin/eb-keep-logs
```

The shell script `eb-keep-logs` in this repository is the same tool; copy it onto `PATH`.
The shell script `eb-keep-logs` in this repository is the reference for `failed` and `rotate`, with the same options and output; copy it onto `PATH`.
It refuses `why`, `history`, `failures`, `loads`, `runs`, `used`, `usage`, `pending`, `test-bundle`, `test-compare` and `lifecycle` with `is in the Zig build only` and exit 2: only the binary has them.
It needs `bash`, coreutils, GNU `grep` (for `grep -P`), `sed`, `find`, `gzip`, `awk`, `flock` from util-linux for `rotate` and, for `failed`, `eb`.
Without `grep -P` it still keeps the log and the command output, but not the meson testlog.

Expand Down Expand Up @@ -118,7 +119,21 @@ For a failure class, feed the kept log to eb-stack.
`--json` prints any of these as one line of JSON with `schema_version` 1, for a pipeline's run summary.
All three are in the Zig build only.

## Emit syslog and journald events
Four more commands read records other tools wrote, and are in the Zig build only:

- `eb-keep-logs loads --module NAME FILE` prints who loaded a module, from Lmod's ModuleUsageTracking lines.
- `eb-keep-logs runs --exec PATH FILE` prints who ran an executable, from XALT run records.
- `eb-keep-logs pending FILE` prints what an `eb --dry-run` or `--missing-modules` report still has to build.
- `eb-keep-logs used --prefix PREFIX FILE...` lists the paths under a prefix that XALT and Lmod records name.

Two commands compare test runs, also in the Zig build only:

- `eb-keep-logs test-bundle` writes one JSON evidence bundle for a test run: its id, suite revision, EESSI target, stdout and stderr files, modules, seed and allocation.
- `eb-keep-logs test-compare BUNDLE...` lists which evidence fields differ across two or more bundles, without deciding pass or fail.

## Emit syslog and journald events, and metrics

Pass `--metrics-file PATH` to `failed` or `rotate` to update Prometheus counters for the logs and bytes kept, atomically; `rotate --dry-run` writes none.

Pass `--syslog TARGET` (or set `EB_KEEP_LOGS_SYSLOG`) to `failed` or `rotate` to emit structured RFC 5424 messages (`ebKeepLogs@<PEN>`, with `EB_KEEP_LOGS_SYSLOG_PEN` defaulting to `32473`, the IANA RFC 5398 documentation placeholder until a site or project PEN is assigned) or native `systemd-journald` fields (`journald`, `syslog`, `unix:///path`, `journal+unix:///path`, `udp://host:port`, `tcp://host:port`) with stable `MSGID` values (`EB_KEEP_FAILED`, `EB_KEEP_NONE`, `EB_ROTATE_DONE`) without copying log file contents into syslog.

Expand Down
1 change: 1 addition & 0 deletions changelog.d/+readme-matches-code.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The README says which commands only the Zig binary has and lists loads, runs, used, pending, test-bundle, test-compare and --metrics-file, and COMPAT.md lists --syslog and --metrics-file for failed and rotate.
Loading