[icinga-checkins] icinga.org: icinga2/feature/ido-groups: Include IP address and port in the "New connection" log message

git at icinga.org git at icinga.org
Mon Jul 25 14:49:35 CEST 2016


Module: icinga2
Branch: feature/ido-groups
Commit: 45dd027101fb946ff0b8074f155cc06ce9153be3
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=45dd027101fb946ff0b8074f155cc06ce9153be3

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Mon Jul 25 09:31:38 2016 +0200

Include IP address and port in the "New connection" log message

fixes #12215

---

 lib/remote/apilistener.cpp |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp
index de2a4f7..cb86697 100644
--- a/lib/remote/apilistener.cpp
+++ b/lib/remote/apilistener.cpp
@@ -330,6 +330,15 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri
 	Endpoint::Ptr endpoint;
 	bool verify_ok = false;
 
+	String conninfo;
+
+	if (role == RoleClient)
+		conninfo = "to";
+	else
+		conninfo = "from";
+
+	conninfo += " " + client->GetPeerAddress();
+
 	if (cert) {
 		try {
 			identity = GetCertificateCN(cert);
@@ -360,7 +369,7 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri
 		{
 			Log log(LogInformation, "ApiListener");
 
-			log << "New client connection for identity '" << identity << "'";
+			log << "New client connection for identity '" << identity << "' " << conninfo;
 
 			if (!verify_ok)
 				log << " (certificate validation failed: " << tlsStream->GetVerifyError() << ")";
@@ -369,7 +378,7 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri
 		}
 	} else {
 		Log(LogInformation, "ApiListener")
-		    << "New client connection (no client certificate)";
+		    << "New client connection " << conninfo << " (no client certificate)";
 	}
 
 	ClientType ctype;



More information about the icinga-checkins mailing list