- Building Serverless Python Web Services with Zappa
- Abdulwahid Abdulhaque Barguzar
- 171字
- 2021-07-16 18:16:15
Tailing logs
Zappa provides a facility for watching the logs related to your deployment. You can simply use the following command:
$ zappa tail production
This will print all logs related to HTTP requests and AWS events. If you want to print logs related to HTTP requests, you can simply pass the --http argument:
$ zappa tail production --http
You can reverse the preceding command with non-HTTP events and log messages by simply using the following code::
$ zappa tail production --non-http
You can also limit the log with respect to time using the --since argument:
$ zappa tail production --since 1h # 1 hour
$ zappa tail production --since 1m # 1 minute
$ zappa tail production --since 1mm # 1 month
You can also filter the logs with the --filter argument, for example:
$ zappa tail production --since 1h --http --filter “POST”
This will show only HTTP POST requests for the last hour. This uses the AWS CloudWatch log-filter pattern (http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html).