Fix systemd journal plugin OTEL log directory discovery (#22569)
fix(systemd-journal): scan OTEL journals under NETDATA_LOG_DIR The systemd journal plugin checked NETDATA_LOG_DIR before adding the OTEL journal directory, but built the path from NETDATA_HOST_PREFIX. This made the plugin scan /otel, or <host-prefix>/otel, instead of the configured Netdata log directory. Build the OTEL scan path from NETDATA_LOG_DIR so the plugin discovers the default <log-dir>/otel/v1 journal files, including custom log directory installations.
Stelios Fragkakis committed
May 26, 2026 at 20:21 UTC
59e2da4fe4aee8e190563ac6dc4bb45a411ae1da
1 file changed
+4
-4
src/collectors/systemd-journal.plugin/systemd-journal-files.c
+4
-4
@@ -866,12 +866,12 @@ void nd_journal_init_files_and_directories(void)
866
journal_directories[d++].path = string_strdupz(path);
867
}
868
869
- const char *netdata_configured_log_dir = getenv("NETDATA_LOG_DIR");
870
- if (netdata_configured_log_dir != NULL) {
869
+ const char *log_dir = getenv("NETDATA_LOG_DIR");
870
+ if (log_dir && *log_dir) {
871
char path[PATH_MAX];
872
- snprintfz(path, sizeof(path), "%s/otel", netdata_configured_host_prefix);
872
+ snprintfz(path, sizeof(path), "%s/otel", log_dir);
873
journal_directories[d++].path = string_strdupz(path);
874
- };
874
+ }
875
876
// terminate the list
877
journal_directories[d].path = NULL;