fix: update log file handling to include timestamp in renamed log files

This commit is contained in:
2026-01-12 16:28:09 +01:00
parent 0685de8ffa
commit 9e567ae760
2 changed files with 5 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ use serde::Deserialize;
use serde_json::json;
use crate::{
LOG_FILE_NAME,
data_mgt::{Asset, AssetTracker},
logs::{LogEvent, LogEventType, log_event},
};
@@ -100,7 +101,7 @@ async fn api_stats(assets: web::Data<AssetTracker>) -> Result<HttpResponse, acti
let mut recent_activity: Vec<ActivityItem> = Vec::new();
let mut request_count: usize = 0;
let log_path = format!("{}access.log", LOG_DIR);
let log_path = format!("{}{}", LOG_DIR, LOG_FILE_NAME);
if let Ok(content) = fs::read_to_string(&log_path) {
for line in content.lines() {
if let Ok(entry) = serde_json::from_str::<LogEvent>(line) {