Repository navigation
log FEATURE timestamp and optional Location on stderr log entries - #1832
Merged
Merged
Conversation
niklas-moser
force-pushed
the
log-timestamp-location
branch
from
October 21, 2026 10:02
051a379 to
d0f9478
Compare
michalvasko
requested changes
Oct 21, 2026
michalvasko
left a comment
Member
There was a problem hiding this comment.
Depending on what we agree on exactly, it would be best not to use any new compilation macros and enable customization by other means. Also, the new env variable needs to be documented in the README.
niklas-moser
force-pushed
the
log-timestamp-location
branch
from
October 21, 2026 14:48
d0f9478 to
b9776ed
Compare
Contributor
Author
|
Agree with the changes and updated the PR. Now working without a macro compilation time extension and changing default behaviour only for the timestamp in the logs. |
michalvasko
requested changes
Oct 22, 2026
np2log() prints no timestamp and nothing identifying the emitting element, so deployments prepend one outside the server, typically by forking date(1) once per line. O-RAN WG11 requires both on every security log entry. Every stderr log entry now starts with its date and time. If the NETCONF_LOG_LOCATION environment variable is set, the entry also carries "[Location=<value>]": [2026-08-19T02:28:24.123456789+02:00][INF][Location=10.148.135.52]: NP: Session 80: thread 1 event new RPC. The message is expanded with vasprintf() first instead of being spliced into a format string. syslog is left alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
niklas-moser
force-pushed
the
log-timestamp-location
branch
from
October 22, 2026 10:33
b9776ed to
ff79c20
Compare
michalvasko
approved these changes
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
np2log() prints "[INF]: NP: " to stderr, with no timestamp and nothing identifying the emitting element. O-RAN WG11 (R004 clause 8.4.2 Table 8-2, referring to the O-RAN Security Requirements Specification) requires every security log entry to carry its date and time and a Location field holding the address of the element that emitted it. Deployments currently prepend a timestamp outside the server, typically by forking date(1) once per line, which still leaves the Location field missing.
After review, there is no compile-time option any more:
np_gettimespec(1)and formatted withly_time_ts2str().NETCONF_LOG_LOCATIONenvironment variable is set and not empty, the entry also carries[Location=<value>]. Otherwise no location is printed.The message is expanded with vasprintf() first instead of being spliced into a format string. syslog is left alone. The environment variable is documented in the README.
Built with no warnings against libyang 6.4.13, libnetconf2 4.6.4 and sysrepo 5.2.28.
make format-checkpasses with uncrustify 0.77.1. All tests pass excepttest_sub_ntf_advanced, which fails the same way on the base commit (Module "ietf-netconf" feature "writable-running" not enabled in sysrepo).🤖 Generated with Claude Code