Skip to content

Commit

Permalink
Merge pull request #4 from bcgov/DBC22-2446
Browse files Browse the repository at this point in the history
DBC22-2446: Update logic to find timestamp
  • Loading branch information
wmuldergov authored Jul 10, 2024
2 parents 38acdeb + 5dbfc2e commit fcb424c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compose/openshiftjobs/scripts/analyzeexportlogs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion compose/openshiftjobs/scripts/ziplogs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fcb424c

Please sign in to comment.