Download Cloudwatch Log Streams

0

I am looking to for how to download the log stream data for one of my API gateways. I have found a few resources that seem to answer this issue but none make too much sense to me so I figured I would ask again. Ideally would be downloaded as a text file or possible an extremely nested json. The form it is in when downloaded does not really matter to me, just that I can get it onto my local machine.

Solutions that could be run from VSCode using Python would be ideal but open to other options. Picture included to show the way log stream looks.

CloudwatchLogStream

parkerw
demandé il y a 7 mois357 vues
1 réponse
1

Hi,

To download the log events to your local machine, specifically using Python, you can use the "get_log_events" API using boto3 to run as a script. You can then write the response received to a file (in any format of your choice).

You can also choose to simply use AWS CLI to achieve the same [2].

References:
[1] https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/logs/client/get_log_events.html
[2] https://docs.aws.amazon.com/cli/latest/reference/logs/get-log-events.html#examples

Thanks,
Atul

profile picture
répondu il y a 7 mois
profile picture
EXPERT
vérifié il y a un mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions