Skip to content

Logging Overview

The ClockBound daemon's log streams, and which one to use for common tasks.

ClockBound outputs logs across several distinct streams, each serving a different purpose and audience. This page provides an overview of all log streams and guidance on which to use for common tasks.

Quick reference 

Log StreamLocationFormatDefaultPurpose
Stdout/Stderrstdout/stderrPlain textAlways onStartup, shutdown, clock status changes, errors
synchronization.log<log_directory>NDJSONDisabledClock synchronization information
sources.log<log_directory>NDJSONDisabledPeriodic snapshot summary of all sources
ffevents.log<log_directory>NDJSONDisabledFeed Forward Events: synchronization algorithm data for advanced diagnostics and replay

Use the ClockBound configuration file to enable specific log streams and set their destination, <log_directory>, with logging.log_directory.

Which log to enable? 

"I want to confirm the ClockBound daemon correctly detected my environment" → Check stdout/stderr to confirm the daemon is running and the configuration it applied. Startup failures, permission mismatch and unexpected runtime errors can also be found here.

"I want to confirm I am tracking time" → Start with synchronization.log. It captures periodic snapshots of ClockBound's internal clock and summaries of system clock adjustments.

"I want to know where my time comes from" → Check sources.log. It provides a periodic summary of all configured time sources and their status. The cbctl sources CLI command leverages sources.log for easy inspection.

"I am curious about synchronization details for a post-mortem diagnosis" → Enable the ffevents.log files. These contain the timestamps offered by the time sources, and their processing by ClockBound for expert-level deterministic replay and analysis.

Stdout/Stderr 

  • Output Location: stdout / stderr.
  • Format: Plain-text.
  • Configuration: Always enabled. Verbosity is set with -v/--verbose.

What's logged 

Stdout captures:

  • Daemon startup and shutdown events
  • Environment auto-detection details
  • Per-source configuration and startup information
  • Clock status changes
  • Clock disruption events
  • Clock selection changes
  • Signal handlers (like SIGHUP)
  • Warnings and errors

Stderr captures:

  • Configuration errors that stop the daemon at startup
  • Unexpected errors that terminate the daemon

When to use 

In steady state, these logs are generally sparse. Clock status changes and disruptions should be rare - they represent exceptional events. This is the place to look when something is fundamentally wrong (daemon won't start, repeated errors) rather than for ongoing synchronization details.

Synchronization Log 

  • Output Location: <log_directory>/synchronization.log.
  • Format: Newline-delimited JSON.
  • Configuration: Optional (highly recommended).

The synchronization log is the primary interface for user-driven investigation and troubleshooting.

The synchronization log presents meaningful snapshot summaries of clock quality, the selected source and system clock adjustments, as well as changes to clock status.

For full format details, see Synchronization Log.

What's logged 

  • Daemon Start (daemon_started) - marks each start of the daemon.
  • Clock Accuracy (synchronization) - periodic report on clock status and quality, and on the selected source: its identity, when it was selected, and its clock error bound at that time.
  • Clock Status Changes (clock_status_change) - record of change of clock status.
  • System Clock Adjustments (system_clock_summary, system_clock_step) - periodic report on corrections applied to the operating system clock, and a record of any step applied at startup.

When to use 

Use this log to report on:

  • The clock accuracy that can be achieved (the Clock Error Bound)
  • The time source that provides the most reliable time and why it is selected
  • What clock information is exposed to libclockbound consumers
  • What system clock adjustments were made

Sources Log 

  • File: <log_directory>/sources.log.
  • Format: Newline-delimited JSON.
  • Configuration: Optional (highly recommended).

The sources log provides a periodic snapshot summary of all configured time synchronization sources. It also serves as the backend for the ClockBound client CLI command (cbctl sources).

For full format details, see Sources Log.

What's logged 

Each snapshot includes a per-source summary with:

  • Selection status - when this source was last selected and deselected as the clock.
  • Poll rate - duration between successive timestamps retrieved from the source.
  • Source status - the inferred clock synchronization status of the source, from its latest response.
  • Statistical summary - Clock Error Bound and Request Latency statistical summaries (minimum, median, maximum), and request and response counts.

When to use 

Use this log for:

  • Compliance auditing and verify which time sources are in use and their configuration.
  • Source health monitoring, availability and quality metrics for all time sources.
  • Debugging source issues, identifying sources that have stopped responding or are producing degraded measurements

Feed Forward Events Log 

  • File: <log_directory>/ffevents.log.
  • Format: Newline-delimited JSON.
  • Configuration: Optional (recommended for in-depth analysis).

The Feed Forward Events Log captures every clock synchronization event processed by the feed-forward clock synchronization algorithm. It is designed for advanced diagnostics and replay by time synchronization experts.

For full format details, see Feed Forward Events Log.

What's logged 

  • Time source input - Collections of timestamps retrieved from the time source (NTP timestamps, PHC read, etc.).
  • Clock Synchronization output - The clock built from processing information from the selected time source

When to use 

The Feed Forward Events Log is of interest to expert users who want to dive deeper into the details of the clock synchronization strategy implemented by the ClockBound daemon.

This is particularly useful to replay a stream of events when running post-mortem investigations, or in-depth diagnosis analysis.

Log rotation 

All file-based log streams (synchronization, sources, ffevents) require management via logrotate or equivalent. Logs should be configured with appropriate rotation policies based on your retention needs.

Note: ClockBound registers a SIGHUP handler that closes and re-opens its log file descriptors in order to allow for lossless log rotation via a postrotate script.

Configuration 

Log streams can be individually enabled or disabled via ClockBound configuration. Disabling any log stream reduces the information available for troubleshooting. Log streams other than stdout/stderr are disabled by default.