From 21fc1de226f84c462c0ae288e28b46155b390d9f Mon Sep 17 00:00:00 2001 From: XAMPPRocky <4464295+XAMPPRocky@users.noreply.github.com> Date: Thu, 21 Sep 2023 19:27:49 +0200 Subject: [PATCH] Move maxmind information log to debug and per-session (#797) --- src/maxmind_db.rs | 14 +------------- src/proxy/sessions.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/maxmind_db.rs b/src/maxmind_db.rs index 8906246e4a..22f4d41fea 100644 --- a/src/maxmind_db.rs +++ b/src/maxmind_db.rs @@ -68,19 +68,7 @@ impl MaxmindDb { }; match mmdb.lookup::(ip) { - Ok(asn) => { - tracing::info!( - number = asn.r#as, - organization = asn.as_name, - country_code = asn.as_cc, - prefix = asn.prefix, - prefix_entity = asn.prefix_entity, - prefix_name = asn.prefix_name, - "maxmind information" - ); - - Some(asn) - } + Ok(asn) => Some(asn), Err(error) => { tracing::warn!(%ip, %error, "ip not found in maxmind database"); None diff --git a/src/proxy/sessions.rs b/src/proxy/sessions.rs index 300cf74512..bfc9b6d869 100644 --- a/src/proxy/sessions.rs +++ b/src/proxy/sessions.rs @@ -97,6 +97,18 @@ impl Session { tracing::debug!(source = %s.source, dest = ?s.dest, "Session created"); + if let Some(asn) = &s.asn_info { + tracing::debug!( + number = asn.r#as, + organization = asn.as_name, + country_code = asn.as_cc, + prefix = asn.prefix, + prefix_entity = asn.prefix_entity, + prefix_name = asn.prefix_name, + "maxmind information" + ); + } + self::metrics::total_sessions().inc(); s.active_session_metric().inc(); s.run(downstream_socket, shutdown_rx);