trek10inc / awsume

A utility for easily assuming AWS IAM roles from the command line.
https://awsu.me
MIT License
487 stars 90 forks source link

Replace `autoawsume/main.py : logging.FileHandler` with rotation #162

Closed ryansb closed 10 months ago

ryansb commented 2 years ago

After using awsume for a little while on a new machine, I found a bit over 2GB of logs from autoawsume in ~/.awsume/logs/. It makes sense to have logs for autoawsume to help diagnose issues, but I think maybe 10MB of logs for autoawsume is the most a user would want to retain.

I also noticed the use of the long datetime stamping in the file names, which makes rotation difficult. In the case there are multiple active autoawsumes, the OS will interleave writes. This shouldn't be a problem, because python is specific about disk flushing for logs so the worst that should occur is interleaved lines (line 1 from process A, line 2-5 from process B, so forth). To distinguish processes we could add PID, but I'm not sure what the windows support is for reading PIDs.