Skip to content

Commit

Permalink
do not append hour on daily uploads (#1033)
Browse files Browse the repository at this point in the history
  • Loading branch information
FxKu authored Oct 11, 2024
1 parent a321f35 commit 9edde4d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion postgres-appliance/scripts/upload_pg_log_to_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
def get_file_names():
prev_interval = datetime.now() - timedelta(days=1)
prev_interval_number = prev_interval.strftime('%u')
upload_filename = prev_interval.strftime('%F')

if os.getenv('LOG_SHIP_HOURLY') == 'true':
prev_interval = datetime.now() - timedelta(hours=1)
prev_interval_number = prev_interval.strftime('%u-%H')
upload_filename = prev_interval.strftime('%F-%H')

log_file = os.path.join(os.getenv('PGLOG'), 'postgresql-' + prev_interval_number + '.csv')
archived_log_file = os.path.join(os.getenv('LOG_TMPDIR'), prev_interval.strftime('%F-%H') + '.csv.gz')
archived_log_file = os.path.join(os.getenv('LOG_TMPDIR'), upload_filename + '.csv.gz')

return log_file, archived_log_file

Expand Down

0 comments on commit 9edde4d

Please sign in to comment.