diff --git a/build.zig.zon b/build.zig.zon index d2bf458..774ecb9 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -5,8 +5,8 @@ .minimum_zig_version = "0.17.1", .dependencies = .{ .zig_common = .{ - .url = "git+https://github.com/stackhands/zig-common?ref=v0.11.0#087fec718bc51231055b7d39bcb4b79b6aab07bc", - .hash = "zig_common-0.11.0-kBaPeZhYBQDM1HcfG71qx5QPq24yzH2KIuckzL53zZnV", + .url = "git+https://github.com/stackhands/zig-common?ref=v0.12.0#556a92c8f469449e944175b7dd2993c6037573ed", + .hash = "zig_common-0.12.0-kBaPeZBnBQDdEF6SU_k7R0FFAtuWaDkgydjuzD9sl8_u", }, }, .paths = .{ diff --git a/changelog.d/+syslog-own-identity.misc.md b/changelog.d/+syslog-own-identity.misc.md new file mode 100644 index 0000000..08d4054 --- /dev/null +++ b/changelog.d/+syslog-own-identity.misc.md @@ -0,0 +1 @@ +Built against `zig-common` 0.12.0: eb-keep-logs names its own identity (`eb-keep-logs`, `ebKeepLogs`) for the events it sends, through `syslog.emitFor`. The events are byte for byte what they were. diff --git a/src/main.zig b/src/main.zig index 84f53bf..3eb4d75 100644 --- a/src/main.zig +++ b/src/main.zig @@ -20,6 +20,9 @@ const usage_cmd = @import("usage.zig"); const test_bundle = @import("test_bundle.zig"); const lifecycle = @import("lifecycle.zig"); const syslog = common.syslog; +/// The name events are sent under: the program in the syslog header and in +/// journald, and the name in the structured-data identifier. +const syslog_identity: syslog.Identity = .{ .app = "eb-keep-logs", .sd_name = "ebKeepLogs" }; const metrics = @import("metrics.zig"); const Allocator = std.mem.Allocator; @@ -679,7 +682,7 @@ fn emitFailedSyslog( else (a.print("eb-keep-logs failed: no EasyBuild log kept for {s} ({s})", .{ name, reason }) catch return); - if (!syslog.emit(a, t, 4, msgid, params.items, jfields.items, msg)) { + if (!syslog.emitFor(a, syslog_identity, t, 4, msgid, params.items, jfields.items, msg)) { warn("cannot emit syslog event", .{}); } } @@ -710,7 +713,7 @@ fn emitRotateSyslog( .{ .key = "EB_ROTATE_COMPRESSED", .value = comp_s }, .{ .key = "EB_ROTATE_DELETED", .value = del_s }, }; - if (!syslog.emit(a, t, 6, "EB_ROTATE_DONE", ¶ms, &jfields, msg)) { + if (!syslog.emitFor(a, syslog_identity, t, 6, "EB_ROTATE_DONE", ¶ms, &jfields, msg)) { warn("cannot emit syslog event", .{}); } }