From 5dbfc2e03076d20739f31579ed31943f114c2305 Mon Sep 17 00:00:00 2001 From: Mulder Date: Wed, 10 Jul 2024 08:13:38 -0700 Subject: [PATCH] DBC22-2446: Update logic to find timestamp --- compose/openshiftjobs/scripts/analyzeexportlogs.sh | 2 +- compose/openshiftjobs/scripts/ziplogs.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compose/openshiftjobs/scripts/analyzeexportlogs.sh b/compose/openshiftjobs/scripts/analyzeexportlogs.sh index 402c83a..484153d 100644 --- a/compose/openshiftjobs/scripts/analyzeexportlogs.sh +++ b/compose/openshiftjobs/scripts/analyzeexportlogs.sh @@ -30,7 +30,7 @@ for file in *.gz; do # Check if the file exists and is a regular file if [[ -f $file ]]; then # Extract the date and time part from the filename (assuming UTC timezone) - file_datetime_utc=$(echo "$file" | grep -oE '[0-9]{10}') + file_datetime_utc=$(echo "$file" | grep -oE '[0-9]{10}(?=-access\.log)') # Check if the file date and time in UTC falls within days_ago's start and end time in UTC if [[ $file_datetime_utc -ge $start_time_utc && $file_datetime_utc -le $end_time_utc ]]; then zipped_files+=("$file") diff --git a/compose/openshiftjobs/scripts/ziplogs.sh b/compose/openshiftjobs/scripts/ziplogs.sh index eb599d3..a6d4516 100644 --- a/compose/openshiftjobs/scripts/ziplogs.sh +++ b/compose/openshiftjobs/scripts/ziplogs.sh @@ -10,7 +10,7 @@ log_dir="./logs" # Iterate over log files find "$log_dir" -type f -name '*.log' | while read -r file; do # Extract timestamp from filename - timestamp=$(echo "$file" | grep -oE '[0-9]{10}') + timestamp=$(echo "$file" | grep -oE '[0-9]{10}(?=-access\.log)') # Check if timestamp is less than or equal to previous hour if [[ $timestamp -le $previous_hour ]]; then