From 366b7db4b65b994cd33cf4fd3c1be429be561307 Mon Sep 17 00:00:00 2001 From: Klearchos Chaloulos Date: Tue, 1 Dec 2015 19:29:59 +0200 Subject: journal-remote: split-mode=host, remove port from journal filename When constructing the journal filename to store logs from a remote host, remove the port of the tcp connection, as the port will change with every reboot/connection loss between sender/reveiver machines. Having the port in the filename will cause a new journal file to be created for every reboot or connection loss. For the implementation, a new argument "bool include_port" is added to the getpeername_pretty() function. This is passed to the sockaddr_pretty() function. The value of the include_port argument is set to true in all calls of getpeername_pretty(), except for 2 calls in journal-remote.c, where it is set to false. --- src/core/service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/service.c') diff --git a/src/core/service.c b/src/core/service.c index 41a729c421..d6132d0d73 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -3187,7 +3187,7 @@ int service_set_socket_fd(Service *s, int fd, Socket *sock, bool selinux_context if (s->state != SERVICE_DEAD) return -EAGAIN; - if (getpeername_pretty(fd, &peer) >= 0) { + if (getpeername_pretty(fd, true, &peer) >= 0) { if (UNIT(s)->description) { _cleanup_free_ char *a; -- cgit v1.2.3-54-g00ecf