Skip to content

Commit

Permalink
Move maxmind information log to debug and per-session (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky authored Sep 21, 2023
1 parent 1d2bec6 commit 21fc1de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 1 addition & 13 deletions src/maxmind_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,7 @@ impl MaxmindDb {
};

match mmdb.lookup::<IpNetEntry>(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
Expand Down
12 changes: 12 additions & 0 deletions src/proxy/sessions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 21fc1de

Please sign in to comment.