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:
parent
73b75c8aa4
commit
4573869607
3 changed files with 26 additions and 26 deletions
|
|
@ -58,7 +58,7 @@ impl DevicePoller {
|
|||
let config_clone = config.clone();
|
||||
|
||||
// Spawn the polling thread with 8MB stack for SNMPv3 crypto operations
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"Spawning device poller thread for {} at {}:{}",
|
||||
device_id,
|
||||
config.ip,
|
||||
|
|
@ -68,16 +68,16 @@ impl DevicePoller {
|
|||
.name(format!("poller-{}", device_id))
|
||||
.stack_size(8 * 1024 * 1024) // 8MB stack (default is 2MB)
|
||||
.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)
|
||||
{
|
||||
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");
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"Successfully spawned device poller thread for {}",
|
||||
device_id
|
||||
);
|
||||
|
|
@ -145,7 +145,7 @@ fn run_poller_thread(
|
|||
config: DeviceConfig,
|
||||
mut request_rx: mpsc::UnboundedReceiver<SnmpRequest>,
|
||||
) -> Result<(), String> {
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"Device poller thread started for {} at {}:{}",
|
||||
device_id,
|
||||
config.ip,
|
||||
|
|
@ -174,7 +174,7 @@ fn run_poller_thread(
|
|||
tracing::debug!("Poller thread {} processing WALK {}", device_id, base_oid);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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 {
|
||||
tracing::info!("Poller thread {} exiting due to shutdown", device_id);
|
||||
tracing::debug!("Poller thread {} exiting due to shutdown", device_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tracing::info!("Device poller thread stopped for {}", device_id);
|
||||
tracing::debug!("Device poller thread stopped for {}", device_id);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ impl PollerRegistry {
|
|||
// Release write lock before logging
|
||||
drop(pollers);
|
||||
|
||||
tracing::info!("Created new device poller (total: {})", self.count());
|
||||
tracing::debug!("Created new device poller (total: {})", self.count());
|
||||
poller.log_status();
|
||||
|
||||
poller
|
||||
|
|
@ -57,7 +57,7 @@ impl PollerRegistry {
|
|||
if let Some(poller) = pollers.remove(device_id) {
|
||||
let ip = poller.config().ip.clone();
|
||||
poller.shutdown();
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"Removed device poller for {} (remaining: {})",
|
||||
device_id,
|
||||
pollers.len()
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ impl AgentClient {
|
|||
.send(WsMessage::Text(join_text.into()))
|
||||
.await
|
||||
.map_err(|e| format!("Failed to send join message: {}", e))?;
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"Sent channel join request with token for agent:{}",
|
||||
agent_id
|
||||
);
|
||||
|
|
@ -267,7 +267,7 @@ impl AgentClient {
|
|||
|
||||
match phoenix_msg.event.as_str() {
|
||||
"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
|
||||
"jobs" | "discovery_job" | "backup_job" => {
|
||||
|
|
@ -330,7 +330,7 @@ impl AgentClient {
|
|||
/// No long-running tasks are spawned - the agent is stateless.
|
||||
/// Server handles all scheduling and retries via Oban.
|
||||
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
|
||||
let mut current_device_ids = std::collections::HashSet::new();
|
||||
|
|
@ -352,7 +352,7 @@ impl AgentClient {
|
|||
|
||||
for job in job_list.jobs {
|
||||
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 {
|
||||
JobType::Mikrotik => {
|
||||
|
|
@ -522,7 +522,7 @@ impl AgentClient {
|
|||
.await
|
||||
.map_err(|e| format!("Writer task closed: {}", e))?;
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"Sent credential test result (test_id: {}, success: {})",
|
||||
result.test_id,
|
||||
result.success
|
||||
|
|
@ -633,7 +633,7 @@ async fn execute_snmp_job(
|
|||
// Log SNMP connection parameters for debugging (mask community for security)
|
||||
let community_masked = redact_community(&snmp_device.community);
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"Executing SNMP job for device {} at {}:{} (community: {}, version: {})",
|
||||
job.device_id,
|
||||
snmp_device.ip,
|
||||
|
|
@ -729,7 +729,7 @@ async fn execute_snmp_job(
|
|||
.as_secs() as i64,
|
||||
};
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"Collected {} OID values for job {}",
|
||||
result.oid_values.len(),
|
||||
job.job_id
|
||||
|
|
@ -757,7 +757,7 @@ async fn execute_credential_test(
|
|||
) -> Result<()> {
|
||||
let mut snmp_device = job.snmp_device.ok_or("Job missing SNMP device info")?;
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"Testing SNMP credentials for {}:{} (version: {})",
|
||||
snmp_device.ip,
|
||||
snmp_device.port,
|
||||
|
|
@ -826,7 +826,7 @@ async fn execute_credential_test(
|
|||
{
|
||||
Ok(value) => {
|
||||
let sys_descr = value_to_string(value);
|
||||
tracing::info!("✓ Credential test succeeded: {}", sys_descr);
|
||||
tracing::debug!("✓ Credential test succeeded: {}", sys_descr);
|
||||
|
||||
CredentialTestResult {
|
||||
test_id: job.job_id.clone(),
|
||||
|
|
@ -884,7 +884,7 @@ async fn execute_ping_job(job: AgentJob, result_tx: mpsc::Sender<MonitoringCheck
|
|||
// Execute ping
|
||||
let result = match crate::ping::ping_device(ip_address, timeout_ms).await {
|
||||
Ok(response_time_ms) => {
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"✓ Device {} is up (response time: {:.1}ms)",
|
||||
device_id,
|
||||
response_time_ms
|
||||
|
|
@ -946,7 +946,7 @@ async fn execute_mikrotik_job(
|
|||
.mikrotik_device
|
||||
.ok_or("Job missing MikroTik device info")?;
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"Executing MikroTik job {} for device {} at {}:{} (ssl: {})",
|
||||
job.job_id,
|
||||
job.device_id,
|
||||
|
|
@ -1093,7 +1093,7 @@ async fn execute_mikrotik_job(
|
|||
timestamp,
|
||||
};
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"MikroTik job {} completed with {} sentences",
|
||||
result.job_id,
|
||||
result.sentences.len()
|
||||
|
|
@ -1120,7 +1120,7 @@ async fn execute_mikrotik_backup_via_ssh(
|
|||
) -> Result<()> {
|
||||
use crate::ssh::SshClient;
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"Executing backup via SSH for device {} at {}:{} (job: {})",
|
||||
job.device_id,
|
||||
mikrotik_device.ip,
|
||||
|
|
@ -1180,7 +1180,7 @@ async fn execute_mikrotik_backup_via_ssh(
|
|||
// Zeroize credentials in protobuf message after use
|
||||
mikrotik_device.password.zeroize();
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"Backup completed: {} bytes, {} lines",
|
||||
config.len(),
|
||||
config.lines().count()
|
||||
|
|
@ -1200,7 +1200,7 @@ async fn execute_mikrotik_backup_via_ssh(
|
|||
timestamp,
|
||||
};
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"MikroTik backup job {} completed successfully",
|
||||
result.job_id
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue