Skip to content

Commit 068050a

Browse files
committed
tracing: Emit native journal MESSAGE_ID for lifecycle events
bootc already routes INFO tracing events to the journal (when run as root), and a number of lifecycle events carry a `message_id` field with a hardcoded 128-bit hex constant, intended to populate systemd's well-known MESSAGE_ID so operators can query e.g. `journalctl MESSAGE_ID=<id>` and hook the message catalog. Two defects prevented this from working: - tracing-journald prefixes all custom fields with `F_`, so the field landed as `F_MESSAGE_ID` rather than the native MESSAGE_ID, and `bootc.image.reference` as `F_BOOTC_IMAGE_REFERENCE`. Dropping the prefix (with_field_prefix(None)) lets the layer's name sanitizer map `message_id` -> MESSAGE_ID and `bootc.image.reference` -> BOOTC_IMAGE_REFERENCE, while MESSAGE is left untouched. - many of the id constants were 33 hex chars (132-bit), which systemd rejects as a malformed MESSAGE_ID. Regenerate them as valid, unique 128-bit values (this also removes two accidental duplicates). Prep for the unified-storage upgrade fix, which relies on these events being usefully queryable in the journal. Assisted-by: opencode (Claude Opus 4.8) Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 2c20ef5 commit 068050a

15 files changed

Lines changed: 31 additions & 23 deletions

File tree

crates/lib/src/bootc_composefs/boot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ pub(crate) async fn setup_composefs_boot(
13241324
pull_result: &composefs_oci::PullResult<Sha512HashValue>,
13251325
allow_missing_fsverity: bool,
13261326
) -> Result<()> {
1327-
const COMPOSEFS_BOOT_SETUP_JOURNAL_ID: &str = "1f0e9d8c7b6a5f4e3d2c1b0a9f8e7d6c5";
1327+
const COMPOSEFS_BOOT_SETUP_JOURNAL_ID: &str = "ed426a753d3f4d698528c0228449de3f";
13281328

13291329
tracing::info!(
13301330
message_id = COMPOSEFS_BOOT_SETUP_JOURNAL_ID,

crates/lib/src/bootc_composefs/delete.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pub(crate) async fn delete_composefs_deployment(
208208
storage: &Storage,
209209
booted_cfs: &BootedComposefs,
210210
) -> Result<()> {
211-
const COMPOSEFS_DELETE_JOURNAL_ID: &str = "2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e7d6";
211+
const COMPOSEFS_DELETE_JOURNAL_ID: &str = "52b55a65303244158335bfd03007bbc4";
212212

213213
tracing::info!(
214214
message_id = COMPOSEFS_DELETE_JOURNAL_ID,

crates/lib/src/bootc_composefs/finalize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub(crate) async fn composefs_backend_finalize(
5353
storage: &Storage,
5454
booted_cfs: &BootedComposefs,
5555
) -> Result<()> {
56-
const COMPOSEFS_FINALIZE_JOURNAL_ID: &str = "0e9d8c7b6a5f4e3d2c1b0a9f8e7d6c5b4";
56+
const COMPOSEFS_FINALIZE_JOURNAL_ID: &str = "a0f2b2cf274c4239b4b2a8c0f278c2cf";
5757

5858
tracing::info!(
5959
message_id = COMPOSEFS_FINALIZE_JOURNAL_ID,

crates/lib/src/bootc_composefs/gc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ pub(crate) async fn composefs_gc(
219219
booted_cfs: &BootedComposefs,
220220
gc_opts: GCOpts,
221221
) -> Result<GcResult> {
222-
const COMPOSEFS_GC_JOURNAL_ID: &str = "3b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e7";
222+
const COMPOSEFS_GC_JOURNAL_ID: &str = "09ef238c077343fc9ac0fb82cb56a387";
223223

224224
tracing::info!(
225225
message_id = COMPOSEFS_GC_JOURNAL_ID,

crates/lib/src/bootc_composefs/repo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub(crate) async fn initialize_composefs_repository(
7979
allow_missing_fsverity: bool,
8080
use_unified: bool,
8181
) -> Result<PullResult<Sha512HashValue>> {
82-
const COMPOSEFS_REPO_INIT_JOURNAL_ID: &str = "5d4c3b2a1f0e9d8c7b6a5f4e3d2c1b0a9";
82+
const COMPOSEFS_REPO_INIT_JOURNAL_ID: &str = "3cae9eff71b64f50b63d856a02ba217c";
8383

8484
let rootfs_dir = &root_setup.physical_root;
8585
let image_name = &state.source.imageref.name;
@@ -278,7 +278,7 @@ pub(crate) async fn pull_composefs_repo(
278278
allow_missing_fsverity: bool,
279279
use_unified: bool,
280280
) -> Result<PullRepoResult> {
281-
const COMPOSEFS_PULL_JOURNAL_ID: &str = "4c3b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8";
281+
const COMPOSEFS_PULL_JOURNAL_ID: &str = "bd0a8ed0d5004a1e9d6ba429992c2eb7";
282282

283283
let imgref = spec_imgref.to_image_proxy_ref()?;
284284

crates/lib/src/bootc_composefs/rollback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ pub(crate) async fn composefs_rollback(
186186
storage: &Storage,
187187
booted_cfs: &BootedComposefs,
188188
) -> Result<()> {
189-
const COMPOSEFS_ROLLBACK_JOURNAL_ID: &str = "6f5e4d3c2b1a0f9e8d7c6b5a4e3d2c1b0";
189+
const COMPOSEFS_ROLLBACK_JOURNAL_ID: &str = "4337b7d6663e42d09ba176075646922b";
190190

191191
tracing::info!(
192192
message_id = COMPOSEFS_ROLLBACK_JOURNAL_ID,

crates/lib/src/bootc_composefs/switch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub(crate) async fn switch_composefs(
3838
anyhow::bail!("Target image is undefined")
3939
};
4040

41-
const COMPOSEFS_SWITCH_JOURNAL_ID: &str = "7a6b5c4d3e2f1a0b9c8d7e6f5a4b3c2d1";
41+
const COMPOSEFS_SWITCH_JOURNAL_ID: &str = "087ccc03481a477b83c0f6ba62500724";
4242

4343
tracing::info!(
4444
message_id = COMPOSEFS_SWITCH_JOURNAL_ID,

crates/lib/src/bootc_composefs/update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ pub(crate) async fn upgrade_composefs(
344344
storage: &Storage,
345345
composefs: &BootedComposefs,
346346
) -> Result<()> {
347-
const COMPOSEFS_UPGRADE_JOURNAL_ID: &str = "9c8d7f6e5a4b3c2d1e0f9a8b7c6d5e4f3";
347+
const COMPOSEFS_UPGRADE_JOURNAL_ID: &str = "01fcba11aadb493c9226158e896a069e";
348348

349349
tracing::info!(
350350
message_id = COMPOSEFS_UPGRADE_JOURNAL_ID,

crates/lib/src/boundimage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub(crate) struct ResolvedBoundImage {
4040
/// Given a deployment, pull all container images it references.
4141
pub(crate) async fn pull_bound_images(sysroot: &Storage, deployment: &Deployment) -> Result<()> {
4242
// Log the bound images operation to systemd journal
43-
const BOUND_IMAGES_JOURNAL_ID: &str = "1a0b9c8d7e6f5a4b3c2d1e0f9a8b7c6d5";
43+
const BOUND_IMAGES_JOURNAL_ID: &str = "0c1b3a5e81784fcf9484770bce6acd8a";
4444
tracing::info!(
4545
message_id = BOUND_IMAGES_JOURNAL_ID,
4646
bootc.deployment.osname = deployment.osname().as_str(),

crates/lib/src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ async fn switch_ostree(
13951395
}
13961396

13971397
// Log the switch operation to systemd journal
1398-
const SWITCH_JOURNAL_ID: &str = "7a6b5c4d3e2f1a0b9c8d7e6f5a4b3c2d1";
1398+
const SWITCH_JOURNAL_ID: &str = "62d26891bbd54962999b0530b8b62239";
13991399
let old_image = host
14001400
.spec
14011401
.image

0 commit comments

Comments
 (0)