mlevit / aws-auto-cleanup

Programmatically delete AWS resources based on an allowlist and time to live (TTL) settings
MIT License
496 stars 55 forks source link

What needs to be changed to change the name of the execution log CSV files? #88

Closed atqhg23 closed 2 years ago

atqhg23 commented 2 years ago

Is your feature request related to a problem? Please describe. No, I am just trying to change the name of the execution log CSV files.

Describe the solution you'd like I am trying to change the name of the execution log CSV files, and I changed the value in the app/src/main.py file. Below is what I changed:

Line 527 key = f"""{now.strftime("%Y")}/{now.strftime("%m")}/execution_log_{now.strftime("%Y_%m_%d_%H_%M_%S")}.csv"""

When I changed the line above, there is an issue with the API and no files come up now. A 400 Bad Request status code comes up. I think something else needs to be changed in the source code for the API, or index files. I searched the repo to see what else may need to change, but could not find this. I'm probably missing something simple, but appreciate any help on this.

mlevit commented 2 years ago

You'll need to look into https://github.com/servian/aws-auto-cleanup/blob/master/api/src/execution_log/list.py#L36

atqhg23 commented 2 years ago

Apologies I'm not too familiar with Boto3 or Python. Can you explain what this part is doing key[22:41]? I looked into the strptime() method, but am not sure about this part and how it's changing the string to create the datetime object.

I am trying to change the name of the S3 object from execution_log_2020_10_20_09_23_44.csv to destroy_log_2020_10_20_09_23_44.csv

mlevit commented 2 years ago

key[22:41] means we're extracting the characters from index 22 to index 41. In other words, we're extracting 2020_10_20_09_23_44 from the file name.

atqhg23 commented 2 years ago

Ahh got it, thanks!