Search code examples
pythonaws-cliamazon-cloudwatchamazon-cloudwatchlogs

Aws CloudWatch Get Log Group and Log Stream data in python


Hey guys so I'm basically using python to figure out a way to get the most recent log stream and date of that log stream for every log group. Afterwards I want to be able to display the log group and how many days it has not been written to.

Thanks


Solution

  • You can get all your log groups with describe_log_groups and once you have them you can get the most recently modified log stream with describe_log_streams (you'll need to orderBy=LastEventTime, descending=True, limit=1).