Reduce log noise by changing INFO to DEBUG for routine operations

Changed the following from INFO to DEBUG level:
- Channel join messages
- Job execution start/completion messages
- SNMP operation messages (GET/WALK)
- Device health check results
- MikroTik job execution
- Device poller thread lifecycle
- Credential test messages
- OID collection results

These messages were generating excessive noise during normal operation.
Kept INFO level for:
- Initial connection establishment
- Shutdown/restart messages
- Update operations
- Errors (already at ERROR/WARN level)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Graham McIntire 2026-02-10 16:49:58 -06:00
parent 73b75c8aa4
commit 4573869607
No known key found for this signature in database
3 changed files with 26 additions and 26 deletions

View file

@ -58,7 +58,7 @@ impl DevicePoller {
let config_clone = config.clone(); let config_clone = config.clone();
// Spawn the polling thread with 8MB stack for SNMPv3 crypto operations // Spawn the polling thread with 8MB stack for SNMPv3 crypto operations
tracing::info!( tracing::debug!(
"Spawning device poller thread for {} at {}:{}", "Spawning device poller thread for {} at {}:{}",
device_id, device_id,
config.ip, config.ip,
@ -68,16 +68,16 @@ impl DevicePoller {
.name(format!("poller-{}", device_id)) .name(format!("poller-{}", device_id))
.stack_size(8 * 1024 * 1024) // 8MB stack (default is 2MB) .stack_size(8 * 1024 * 1024) // 8MB stack (default is 2MB)
.spawn(move || { .spawn(move || {
tracing::info!("Device poller thread starting for {}", device_id_clone); tracing::debug!("Device poller thread starting for {}", device_id_clone);
if let Err(e) = run_poller_thread(device_id_clone.clone(), config_clone, request_rx) if let Err(e) = run_poller_thread(device_id_clone.clone(), config_clone, request_rx)
{ {
tracing::error!("Device poller thread failed for {}: {}", device_id_clone, e); tracing::error!("Device poller thread failed for {}: {}", device_id_clone, e);
} }
tracing::info!("Device poller thread exited for {}", device_id_clone); tracing::debug!("Device poller thread exited for {}", device_id_clone);
}) })
.expect("Failed to spawn device poller thread"); .expect("Failed to spawn device poller thread");
tracing::info!( tracing::debug!(
"Successfully spawned device poller thread for {}", "Successfully spawned device poller thread for {}",
device_id device_id
); );
@ -145,7 +145,7 @@ fn run_poller_thread(
config: DeviceConfig, config: DeviceConfig,
mut request_rx: mpsc::UnboundedReceiver<SnmpRequest>, mut request_rx: mpsc::UnboundedReceiver<SnmpRequest>,
) -> Result<(), String> { ) -> Result<(), String> {
tracing::info!( tracing::debug!(
"Device poller thread started for {} at {}:{}", "Device poller thread started for {} at {}:{}",
device_id, device_id,
config.ip, config.ip,
@ -174,7 +174,7 @@ fn run_poller_thread(
tracing::debug!("Poller thread {} processing WALK {}", device_id, base_oid); tracing::debug!("Poller thread {} processing WALK {}", device_id, base_oid);
} }
SnmpRequest::Shutdown => { SnmpRequest::Shutdown => {
tracing::info!("Poller thread {} received shutdown signal", device_id); tracing::debug!("Poller thread {} received shutdown signal", device_id);
} }
} }
@ -204,7 +204,7 @@ fn run_poller_thread(
let _ = response_tx.send(result); let _ = response_tx.send(result);
} }
SnmpRequest::Shutdown => { SnmpRequest::Shutdown => {
tracing::info!("Device poller thread shutting down for {}", device_id); tracing::debug!("Device poller thread shutting down for {}", device_id);
} }
})); }));
@ -227,12 +227,12 @@ fn run_poller_thread(
} }
if is_shutdown { if is_shutdown {
tracing::info!("Poller thread {} exiting due to shutdown", device_id); tracing::debug!("Poller thread {} exiting due to shutdown", device_id);
break; break;
} }
} }
tracing::info!("Device poller thread stopped for {}", device_id); tracing::debug!("Device poller thread stopped for {}", device_id);
Ok(()) Ok(())
} }

View file

@ -43,7 +43,7 @@ impl PollerRegistry {
// Release write lock before logging // Release write lock before logging
drop(pollers); drop(pollers);
tracing::info!("Created new device poller (total: {})", self.count()); tracing::debug!("Created new device poller (total: {})", self.count());
poller.log_status(); poller.log_status();
poller poller
@ -57,7 +57,7 @@ impl PollerRegistry {
if let Some(poller) = pollers.remove(device_id) { if let Some(poller) = pollers.remove(device_id) {
let ip = poller.config().ip.clone(); let ip = poller.config().ip.clone();
poller.shutdown(); poller.shutdown();
tracing::info!( tracing::debug!(
"Removed device poller for {} (remaining: {})", "Removed device poller for {} (remaining: {})",
device_id, device_id,
pollers.len() pollers.len()

View file

@ -133,7 +133,7 @@ impl AgentClient {
.send(WsMessage::Text(join_text.into())) .send(WsMessage::Text(join_text.into()))
.await .await
.map_err(|e| format!("Failed to send join message: {}", e))?; .map_err(|e| format!("Failed to send join message: {}", e))?;
tracing::info!( tracing::debug!(
"Sent channel join request with token for agent:{}", "Sent channel join request with token for agent:{}",
agent_id agent_id
); );
@ -267,7 +267,7 @@ impl AgentClient {
match phoenix_msg.event.as_str() { match phoenix_msg.event.as_str() {
"phx_reply" => { "phx_reply" => {
tracing::info!("Channel join reply: {:?}", phoenix_msg.payload); tracing::debug!("Channel join reply: {:?}", phoenix_msg.payload);
} }
// Handle all job events the same way - agent doesn't care about the context // Handle all job events the same way - agent doesn't care about the context
"jobs" | "discovery_job" | "backup_job" => { "jobs" | "discovery_job" | "backup_job" => {
@ -330,7 +330,7 @@ impl AgentClient {
/// No long-running tasks are spawned - the agent is stateless. /// No long-running tasks are spawned - the agent is stateless.
/// Server handles all scheduling and retries via Oban. /// Server handles all scheduling and retries via Oban.
async fn handle_jobs(&self, job_list: AgentJobList) -> Result<()> { async fn handle_jobs(&self, job_list: AgentJobList) -> Result<()> {
tracing::info!("Received {} jobs from server", job_list.jobs.len()); tracing::debug!("Received {} jobs from server", job_list.jobs.len());
// Collect device IDs from current jobs // Collect device IDs from current jobs
let mut current_device_ids = std::collections::HashSet::new(); let mut current_device_ids = std::collections::HashSet::new();
@ -352,7 +352,7 @@ impl AgentClient {
for job in job_list.jobs { for job in job_list.jobs {
let job_type = JobType::try_from(job.job_type).unwrap_or(JobType::Poll); let job_type = JobType::try_from(job.job_type).unwrap_or(JobType::Poll);
tracing::info!("Executing job: {} (type: {:?})", job.job_id, job_type); tracing::debug!("Executing job: {} (type: {:?})", job.job_id, job_type);
match job_type { match job_type {
JobType::Mikrotik => { JobType::Mikrotik => {
@ -522,7 +522,7 @@ impl AgentClient {
.await .await
.map_err(|e| format!("Writer task closed: {}", e))?; .map_err(|e| format!("Writer task closed: {}", e))?;
tracing::info!( tracing::debug!(
"Sent credential test result (test_id: {}, success: {})", "Sent credential test result (test_id: {}, success: {})",
result.test_id, result.test_id,
result.success result.success
@ -633,7 +633,7 @@ async fn execute_snmp_job(
// Log SNMP connection parameters for debugging (mask community for security) // Log SNMP connection parameters for debugging (mask community for security)
let community_masked = redact_community(&snmp_device.community); let community_masked = redact_community(&snmp_device.community);
tracing::info!( tracing::debug!(
"Executing SNMP job for device {} at {}:{} (community: {}, version: {})", "Executing SNMP job for device {} at {}:{} (community: {}, version: {})",
job.device_id, job.device_id,
snmp_device.ip, snmp_device.ip,
@ -729,7 +729,7 @@ async fn execute_snmp_job(
.as_secs() as i64, .as_secs() as i64,
}; };
tracing::info!( tracing::debug!(
"Collected {} OID values for job {}", "Collected {} OID values for job {}",
result.oid_values.len(), result.oid_values.len(),
job.job_id job.job_id
@ -757,7 +757,7 @@ async fn execute_credential_test(
) -> Result<()> { ) -> Result<()> {
let mut snmp_device = job.snmp_device.ok_or("Job missing SNMP device info")?; let mut snmp_device = job.snmp_device.ok_or("Job missing SNMP device info")?;
tracing::info!( tracing::debug!(
"Testing SNMP credentials for {}:{} (version: {})", "Testing SNMP credentials for {}:{} (version: {})",
snmp_device.ip, snmp_device.ip,
snmp_device.port, snmp_device.port,
@ -826,7 +826,7 @@ async fn execute_credential_test(
{ {
Ok(value) => { Ok(value) => {
let sys_descr = value_to_string(value); let sys_descr = value_to_string(value);
tracing::info!("✓ Credential test succeeded: {}", sys_descr); tracing::debug!("✓ Credential test succeeded: {}", sys_descr);
CredentialTestResult { CredentialTestResult {
test_id: job.job_id.clone(), test_id: job.job_id.clone(),
@ -884,7 +884,7 @@ async fn execute_ping_job(job: AgentJob, result_tx: mpsc::Sender<MonitoringCheck
// Execute ping // Execute ping
let result = match crate::ping::ping_device(ip_address, timeout_ms).await { let result = match crate::ping::ping_device(ip_address, timeout_ms).await {
Ok(response_time_ms) => { Ok(response_time_ms) => {
tracing::info!( tracing::debug!(
"✓ Device {} is up (response time: {:.1}ms)", "✓ Device {} is up (response time: {:.1}ms)",
device_id, device_id,
response_time_ms response_time_ms
@ -946,7 +946,7 @@ async fn execute_mikrotik_job(
.mikrotik_device .mikrotik_device
.ok_or("Job missing MikroTik device info")?; .ok_or("Job missing MikroTik device info")?;
tracing::info!( tracing::debug!(
"Executing MikroTik job {} for device {} at {}:{} (ssl: {})", "Executing MikroTik job {} for device {} at {}:{} (ssl: {})",
job.job_id, job.job_id,
job.device_id, job.device_id,
@ -1093,7 +1093,7 @@ async fn execute_mikrotik_job(
timestamp, timestamp,
}; };
tracing::info!( tracing::debug!(
"MikroTik job {} completed with {} sentences", "MikroTik job {} completed with {} sentences",
result.job_id, result.job_id,
result.sentences.len() result.sentences.len()
@ -1120,7 +1120,7 @@ async fn execute_mikrotik_backup_via_ssh(
) -> Result<()> { ) -> Result<()> {
use crate::ssh::SshClient; use crate::ssh::SshClient;
tracing::info!( tracing::debug!(
"Executing backup via SSH for device {} at {}:{} (job: {})", "Executing backup via SSH for device {} at {}:{} (job: {})",
job.device_id, job.device_id,
mikrotik_device.ip, mikrotik_device.ip,
@ -1180,7 +1180,7 @@ async fn execute_mikrotik_backup_via_ssh(
// Zeroize credentials in protobuf message after use // Zeroize credentials in protobuf message after use
mikrotik_device.password.zeroize(); mikrotik_device.password.zeroize();
tracing::info!( tracing::debug!(
"Backup completed: {} bytes, {} lines", "Backup completed: {} bytes, {} lines",
config.len(), config.len(),
config.lines().count() config.lines().count()
@ -1200,7 +1200,7 @@ async fn execute_mikrotik_backup_via_ssh(
timestamp, timestamp,
}; };
tracing::info!( tracing::debug!(
"MikroTik backup job {} completed successfully", "MikroTik backup job {} completed successfully",
result.job_id result.job_id
); );