Configuration
Turn on log file streams and add NTP time sources with an optional TOML file.
ClockBound is designed to run with zero configuration. It detects and uses the best time sources on the instance on its own. Configuration exists for two things: turning on log file streams, and adding NTP time sources.
Quick start
ClockBound reads a configuration file only when you point it at one:
clockbound --configuration /path/to/clockbound.tomlWith no --configuration (-c) flag, the daemon runs on built-in defaults and auto-detected time sources, logging to stdout/stderr only.
Example configuration
The configuration file format is TOML; an empty file behaves the same as no file at all. The block below illustrates the available settings.
[logging]
log_directory = "/var/log/clockbound" # directory for the log streams below
[logging.synchronization]
enabled = true
[logging.sources]
enabled = true
[logging.ffevents]
enabled = true
# The sources below use documentation-only addresses and names that never
# resolve or respond. Replace them with your own, or remove the blocks.
[[sources.ntp]] # a single server, by IPv4
server = "192.0.2.1"
[[sources.ntp]] # a single server, by IPv6
server = "2001:db8::123"
[[sources.ntp]] # a single server, by hostname
server = "ntp.corp.example"
[[sources.ntp]] # a name expected to resolve to several servers
pool = "pool.ntp.example"[logging]
Controls ClockBound's file log streams. For details on the streams themselves, see the ClockBound Logging documentation.
A stream is written only when its section is present with enabled = true.
Enabled file streams grow without bound unless you rotate them. Manage them with retention set to your disk budget and audit needs. See the example logrotate configuration.
logging.log_directory
- Type: string
- Required when any log stream is enabled.
- Must be an absolute path.
The directory that holds every enabled log file stream.
[logging.synchronization]
logging.synchronization.enabled
- Type: boolean
- Default:
false
Enables the synchronization log stream.
[logging.sources]
logging.sources.enabled
- Type: boolean
- Default:
false
Enables the sources log stream.
[logging.ffevents]
logging.ffevents.enabled
- Type: boolean
- Default:
false
Enables the ffevents log stream.
[sources]
Sources here are added to what ClockBound already uses. Add them when you have a specific need, such as an on-premises reference clock or a national metrology institute's pool.
You can configure at most 5 server entries and 1 pool; exceeding either fails startup. Each source may appear only once: the same value listed twice, including the same name under both server and pool, also fails startup.
[[sources.ntp]]
Each block adds one NTP time source, written as either a server or a pool.
sources.ntp.server
- Type: string (hostname or IPv4/IPv6 address)
A single time source. If a name resolves to several addresses, only one is used; use pool for the set.
sources.ntp.pool
- Type: string (name)
A name expected to resolve to several servers, rather than the single source a server entry names. A pool must be a name; an IPv4 or IPv6 address is rejected.
Validation and startup
The file is read once, at startup. To apply a configuration change, restart the daemon.
ClockBound validates the whole file before it starts. Any problem — a missing or unreadable configuration file, a syntax or type error, an unknown or misspelled setting, or an invalid combination — is a hard startup failure, where the daemon exits with code 2 and writes the cause to stderr. The rules checked after parsing are:
- At most 5
serverentries and 1poolentry. - No source value listed more than once.
- A
poolvalue is a name, never an IP address. logging.log_directoryis an absolute path.logging.log_directoryis set when any log stream is enabled.
A file that parses is checked against all of these rules at once, and every violation is reported in the same error.
To validate a file without starting the daemon, pass --check-configuration along with it. The daemon reports whether the file is valid and exits.
clockbound --check-configuration --configuration /path/to/clockbound.tomlLog verbosity for stdout/stderr
The verbosity of the daemon's stdout/stderr output is set by a command-line flag:
-v/--verboseraises verbosity from the defaultinfolevel todebug.
File log streams are unaffected by this flag. They have their own [logging.*] toggles and always log their defined content.
Pass the flag when you start the daemon:
clockbound --configuration /path/to/clockbound.toml -v