]> git.ipfire.org Git - thirdparty/pdns.git/commit
Add Protobuf logger written in Rust.
authorKevin P. Fleming <kevin@km6g.us>
Sat, 5 Jul 2025 20:27:24 +0000 (16:27 -0400)
committerKevin P. Fleming <kevin@km6g.us>
Mon, 7 Jul 2025 10:15:37 +0000 (06:15 -0400)
commit73e0f85707cd147b032f0e98d4898fe11e152188
tree545c0797b9f6f25f750e370bbfc29af78986029d
parente926e9eae51e76c1b709ac5e89c514b7bde0f23f
Add Protobuf logger written in Rust.

This was inspired by the ProtobufLogger.py already present in the
'contrib' directory.

In addition to being written in Rust instead of Python, there are
various other differences:

* Each line of output is prefixed with the sender's 'socket address'
  (IP address and port number).

* Messages from multiple clients will be properly output, they will
  not be mixed.

* Timestamp format is slightly different (full ISO-8601 with UTC
  offset).

* Command-line arguments are handled by a full parser, which can
  generate help text and report the program's version.

* All 'optional' fields in the protobuf messages are checked for
  presence before being read.

* Output to stdout will never block reception/decoding/formatting of
  protobuf messages; if stdout blocks for some reason, incoming
  messages will be stored in memory until they can be printed.

* Summary, meta, and question lines are printed; responses are not,
  nor is OpenTelemetry data. Future work for another contributor!

* 'meta' output is untested.

* A Cargo feature 'opentelemetry' is available to be the starting
  point of OT support.

No AI or LLM tools were used in the creation or testing of this code.
contrib/pblogger-rs/.gitignore [new file with mode: 0644]
contrib/pblogger-rs/Cargo.toml [new file with mode: 0644]
contrib/pblogger-rs/build.rs [new file with mode: 0644]
contrib/pblogger-rs/rust-toolchain.toml [new file with mode: 0644]
contrib/pblogger-rs/rustfmt.toml [new file with mode: 0644]
contrib/pblogger-rs/src/display.rs [new file with mode: 0644]
contrib/pblogger-rs/src/listener.rs [new file with mode: 0644]
contrib/pblogger-rs/src/main.rs [new file with mode: 0644]