Recently while working on log aggregation utilities for the OpenCHAMI services, I noticed many don't yet utilize a structured logging mechanism which results in increased difficulties for downstream monitoring efforts, mostly by way of overly complex/fragile regex.
Some logs are plain unstructured text, some are standard logfmt, and others fall into well-structured formats like JSON.
Below are some examples of attempts to automatically parse information from the smd logs (note, the original log message is in the JSON message property):
{
"appname": "smd",
"component_id": null,
"data": {
"-": true,
"172.16.0.254": true,
"200": true,
"2026/03/02": true,
"2302B": true,
"23:46:15": true,
"524.311µs": true,
"GET http://demo.openchami.cluster:8443/hsm/v2/Inventory/EthernetInterfaces HTTP/1.1": true,
"[smd/O7SH03fs8M-003832]": true,
"from": true,
"in": true
},
"facility": "user",
"host": "localhost",
"hostname": "localhost",
"message": "2026/03/02 23:46:15 [smd/O7SH03fs8M-003832] \"GET http://demo.openchami.cluster:8443/hsm/v2/Inventory/EthernetInterfaces HTTP/1.1\" from 172.16.0.254 - 200 2302B in 524.311µs",
"node_id": null,
"parse_error": null,
"procid": 3274397,
"request_id": null,
"request_uri": null,
"request_user": null,
"severity": "info",
"source_ip": "127.0.0.1",
"source_type": "syslog",
"timestamp": "2026-03-02T16:46:15Z",
"trace_id": null,
"xname": null
}
Above, the weirdness in the .data subtree is caused by an attempt to parse the unstructured text in .message as logfmt (which is the default parser assigned to this service as it simplifies extraction for examples like those below.
{
"appname": "smd",
"component_id": null,
"data": {
"11:46PM": true,
"INF": true,
"Request": true,
"bytes_in": "0",
"bytes_out": "732",
"duration": "0.664907",
"method": "GET",
"remote_addr": "172.16.0.254",
"request_id": "smd/O7SH03fs8M-003833",
"request_uri": "/hsm/v2/State/Components",
"status": "OK",
"status_code": "200",
"user_agent": "Go-http-client/1.1"
},
"facility": "user",
"host": "localhost",
"hostname": "localhost",
"message": "11:46PM INF Request bytes_in=0 bytes_out=732 duration=0.664907 method=GET remote_addr=172.16.0.254 request_id=smd/O7SH03fs 8M-003833 request_uri=/hsm/v2/State/Components status=OK status_code=200 user_agent=Go-http-client/1.1",
"node_id": null,
"parse_error": null,
"procid": 3274397,
"request_id": "smd/O7SH03fs8M-003833",
"request_uri": "/hsm/v2/State/Components",
"request_user": null,
"severity": "err",
"source_ip": "127.0.0.1",
"source_type": "syslog",
"timestamp": "2026-03-02T16:46:15Z",
"trace_id": null,
"xname": null
}
Upon a quick skim of the repository contents, I've determined these logs originated from calls to routines like these here below:
|
func DebugRequest(log *logrus.Entry, req *dhcpv4.DHCPv4) { |
|
log.Debugf("REQUEST: %v", req.Summary()) |
|
} |
|
|
|
func DebugResponse(log *logrus.Entry, resp *dhcpv4.DHCPv4) { |
|
log.Debugf("RESPONSE: %v", resp.Summary()) |
|
} |
Would it be possible to switch to a fully structured logging format? It would greatly simplify downstream monitoring efforts.
Recently while working on log aggregation utilities for the OpenCHAMI services, I noticed many don't yet utilize a structured logging mechanism which results in increased difficulties for downstream monitoring efforts, mostly by way of overly complex/fragile regex.
Some logs are plain unstructured text, some are standard logfmt, and others fall into well-structured formats like JSON.
Below are some examples of attempts to automatically parse information from the
smdlogs (note, the original log message is in the JSONmessageproperty):{ "appname": "smd", "component_id": null, "data": { "-": true, "172.16.0.254": true, "200": true, "2026/03/02": true, "2302B": true, "23:46:15": true, "524.311µs": true, "GET http://demo.openchami.cluster:8443/hsm/v2/Inventory/EthernetInterfaces HTTP/1.1": true, "[smd/O7SH03fs8M-003832]": true, "from": true, "in": true }, "facility": "user", "host": "localhost", "hostname": "localhost", "message": "2026/03/02 23:46:15 [smd/O7SH03fs8M-003832] \"GET http://demo.openchami.cluster:8443/hsm/v2/Inventory/EthernetInterfaces HTTP/1.1\" from 172.16.0.254 - 200 2302B in 524.311µs", "node_id": null, "parse_error": null, "procid": 3274397, "request_id": null, "request_uri": null, "request_user": null, "severity": "info", "source_ip": "127.0.0.1", "source_type": "syslog", "timestamp": "2026-03-02T16:46:15Z", "trace_id": null, "xname": null }Above, the weirdness in the
.datasubtree is caused by an attempt to parse the unstructured text in.messageas logfmt (which is the default parser assigned to this service as it simplifies extraction for examples like those below.{ "appname": "smd", "component_id": null, "data": { "11:46PM": true, "INF": true, "Request": true, "bytes_in": "0", "bytes_out": "732", "duration": "0.664907", "method": "GET", "remote_addr": "172.16.0.254", "request_id": "smd/O7SH03fs8M-003833", "request_uri": "/hsm/v2/State/Components", "status": "OK", "status_code": "200", "user_agent": "Go-http-client/1.1" }, "facility": "user", "host": "localhost", "hostname": "localhost", "message": "11:46PM INF Request bytes_in=0 bytes_out=732 duration=0.664907 method=GET remote_addr=172.16.0.254 request_id=smd/O7SH03fs 8M-003833 request_uri=/hsm/v2/State/Components status=OK status_code=200 user_agent=Go-http-client/1.1", "node_id": null, "parse_error": null, "procid": 3274397, "request_id": "smd/O7SH03fs8M-003833", "request_uri": "/hsm/v2/State/Components", "request_user": null, "severity": "err", "source_ip": "127.0.0.1", "source_type": "syslog", "timestamp": "2026-03-02T16:46:15Z", "trace_id": null, "xname": null }Upon a quick skim of the repository contents, I've determined these logs originated from calls to routines like these here below:
coresmd/internal/debug/debug.go
Lines 13 to 19 in d17a510
Would it be possible to switch to a fully structured logging format? It would greatly simplify downstream monitoring efforts.