Skip to content

logging: include version information in dictionary-based log header #76858

@jpwright

Description

@jpwright

Is your enhancement proposal related to a problem? Please describe.

Consider a device making use of dictionary-based logging to continually write log messages into (limited) flash memory, while also supporting firmware updates. Say that firmware versions 1 and 2 exist, each with their own distinct log dictionaries. If a client downloads all logs from the device's flash memory, those logs may contain a mix of logs generated by the two versions. As a result, parsing the logs into human-readable form is error-prone, because the client does not know which dictionary to use for each log during parsing.

Describe the solution you'd like

Dictionary logs should start with a demarcator, similar to the UART OUTPUT_DICTIONARY_HEX writing ##ZLOGV1## at the start of each log, which also contains the firmware version (based on Zephyr VERSION file). The same version should be present in the generated dictionary JSON. The log parsing tools should verify that the version in the log matches the version in the dictionary, and ideally expose parsing the log's version as a separate operation (to support a flow where the client retrieves the dictionary to match the log).

Describe alternatives you've considered

  • The device could log its firmware version as early as possible during boot, but this would still require brute-force parsing to extract that log message in the first place, and seems like a bad idea to mix log content with format.
  • The client could brute-force parse with every dictionary it has, but this could result in incorrect (but still valid) translations depending on the log contents.
  • The logs could have a rolling ID, such that a client could keep track of the log ID at which a firmware update was applied and look up the proper dictionary based on ID, but this is quite fragile if you have multiple clients.

Additional context

N/A

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions