summaryrefslogtreecommitdiffstats
path: root/libnetdata
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2023-11-22 20:03:02 +0000
committerGitHub <noreply@github.com>2023-11-22 22:03:02 +0200
commit53d4c224eaf4b9c5b69f2b5d6bcc7873e31fca75 (patch)
treeb97c52c251b430561e58ce8349ed7366807dcb6c /libnetdata
parenta5c8d88d78c6203c43011524176c1111647a8622 (diff)
when the namespace socket does not work, continue trying (#16458)
Diffstat (limited to 'libnetdata')
-rw-r--r--libnetdata/log/log.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libnetdata/log/log.c b/libnetdata/log/log.c
index 9061211f25..5680aa0fa7 100644
--- a/libnetdata/log/log.c
+++ b/libnetdata/log/log.c
@@ -687,25 +687,31 @@ static bool nd_log_journal_direct_init(const char *path) {
return true;
}
+ int fd;
char filename[FILENAME_MAX + 1];
if(!is_path_unix_socket(path)) {
+
journal_construct_path(filename, sizeof(filename), netdata_configured_host_prefix, "netdata");
- if (!is_path_unix_socket(filename)) {
+ if (!is_path_unix_socket(filename) || (fd = journal_direct_fd(filename)) == -1) {
+
journal_construct_path(filename, sizeof(filename), netdata_configured_host_prefix, NULL);
- if (!is_path_unix_socket(filename)) {
+ if (!is_path_unix_socket(filename) || (fd = journal_direct_fd(filename)) == -1) {
+
journal_construct_path(filename, sizeof(filename), NULL, "netdata");
- if (!is_path_unix_socket(filename)) {
+ if (!is_path_unix_socket(filename) || (fd = journal_direct_fd(filename)) == -1) {
+
journal_construct_path(filename, sizeof(filename), NULL, NULL);
- if (!is_path_unix_socket(filename))
+ if (!is_path_unix_socket(filename) || (fd = journal_direct_fd(filename)) == -1)
return false;
}
}
}
}
- else
+ else {
snprintfz(filename, sizeof(filename), "%s", path);
+ fd = journal_direct_fd(filename);
+ }
- int fd = journal_direct_fd(filename);
if(fd < 0)
return false;