fix: update log file handling to include timestamp in renamed log files
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user