首页 > 解决方案 > AWS Lambda (Python Zappa) 了解日志

问题描述

Zappa 是一段漂亮的代码,它使您的代码无服务器,无需任何代码。

我试图了解 Zappa 的复杂性,我想从 Logging 开始。我成功地在 AWS Lambdas 上部署了我的 Python Django 应用程序。以下是我无法理解的日志。非常感谢任何帮助。

1589392413834] [DEBUG] 2020-05-13T17:53:33.834Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing BlpImagePlugin
[1589392413854] [DEBUG] 2020-05-13T17:53:33.854Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing BmpImagePlugin
[1589392413894] [DEBUG] 2020-05-13T17:53:33.894Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing BufrStubImagePlugin
[1589392413896] [DEBUG] 2020-05-13T17:53:33.896Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing CurImagePlugin
[1589392413896] [DEBUG] 2020-05-13T17:53:33.896Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing DcxImagePlugin
[1589392413898] [DEBUG] 2020-05-13T17:53:33.898Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing DdsImagePlugin
[1589392413900] [DEBUG] 2020-05-13T17:53:33.900Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing EpsImagePlugin
[1589392413915] [DEBUG] 2020-05-13T17:53:33.915Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing FitsStubImagePlugin
[1589392413915] [DEBUG] 2020-05-13T17:53:33.915Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing FliImagePlugin
[1589392413933] [DEBUG] 2020-05-13T17:53:33.933Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing FpxImagePlugin
[1589392413935] [DEBUG] 2020-05-13T17:53:33.935Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Image: failed to import FpxImagePlugin: No module named 'olefile'
[1589392413935] [DEBUG] 2020-05-13T17:53:33.935Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing FtexImagePlugin
[1589392413936] [DEBUG] 2020-05-13T17:53:33.935Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing GbrImagePlugin
[1589392413936] [DEBUG] 2020-05-13T17:53:33.936Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing GifImagePlugin
[1589392413955] [DEBUG] 2020-05-13T17:53:33.955Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing GribStubImagePlugin
[1589392413973] [DEBUG] 2020-05-13T17:53:33.973Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing Hdf5StubImagePlugin
[1589392413974] [DEBUG] 2020-05-13T17:53:33.974Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing IcnsImagePlugin
[1589392414013] [DEBUG] 2020-05-13T17:53:34.0Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing IcoImagePlugin
[1589392414015] [DEBUG] 2020-05-13T17:53:34.15Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing ImImagePlugin
[1589392414035] [DEBUG] 2020-05-13T17:53:34.35Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing ImtImagePlugin
[1589392414036] [DEBUG] 2020-05-13T17:53:34.36Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing IptcImagePlugin
[1589392414037] [DEBUG] 2020-05-13T17:53:34.37Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing JpegImagePlugin
[1589392414180] [DEBUG] 2020-05-13T17:53:34.180Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing Jpeg2KImagePlugin
[1589392414180] [DEBUG] 2020-05-13T17:53:34.180Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing McIdasImagePlugin
[1589392414193] [DEBUG] 2020-05-13T17:53:34.193Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing MicImagePlugin
[1589392414194] [DEBUG] 2020-05-13T17:53:34.194Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Image: failed to import MicImagePlugin: No module named 'olefile'
[1589392414194] [DEBUG] 2020-05-13T17:53:34.194Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing MpegImagePlugin
[1589392414195] [DEBUG] 2020-05-13T17:53:34.195Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing MpoImagePlugin
[1589392414196] [DEBUG] 2020-05-13T17:53:34.196Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing MspImagePlugin
[1589392414214] [DEBUG] 2020-05-13T17:53:34.214Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing PalmImagePlugin
[1589392414218] [DEBUG] 2020-05-13T17:53:34.217Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing PcdImagePlugin
[1589392414218] [DEBUG] 2020-05-13T17:53:34.218Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing PcxImagePlugin
[1589392414218] [DEBUG] 2020-05-13T17:53:34.218Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing PdfImagePlugin
[1589392414276] [DEBUG] 2020-05-13T17:53:34.276Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing PixarImagePlugin
[1589392414293] [DEBUG] 2020-05-13T17:53:34.293Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing PngImagePlugin
[1589392414293] [DEBUG] 2020-05-13T17:53:34.293Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing PpmImagePlugin
[1589392414294] [DEBUG] 2020-05-13T17:53:34.294Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing PsdImagePlugin
[1589392414296] [DEBUG] 2020-05-13T17:53:34.296Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing SgiImagePlugin
[1589392414298] [DEBUG] 2020-05-13T17:53:34.297Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing SpiderImagePlugin
[1589392414299] [DEBUG] 2020-05-13T17:53:34.299Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing SunImagePlugin
[1589392414300] [DEBUG] 2020-05-13T17:53:34.300Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing TgaImagePlugin
[1589392414314] [DEBUG] 2020-05-13T17:53:34.314Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing TiffImagePlugin
[1589392414314] [DEBUG] 2020-05-13T17:53:34.314Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing WebPImagePlugin
[1589392414336] [DEBUG] 2020-05-13T17:53:34.336Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing WmfImagePlugin
[1589392414338] [DEBUG] 2020-05-13T17:53:34.338Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing XbmImagePlugin
[1589392414340] [DEBUG] 2020-05-13T17:53:34.340Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing XpmImagePlugin
[1589392414354] [DEBUG] 2020-05-13T17:53:34.354Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Importing XVThumbImagePlugin
[1589392416528] [DEBUG] 2020-05-13T17:53:36.528Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
[1589392416532] [DEBUG] 2020-05-13T17:53:36.532Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Changing event name from before-call.apigateway to before-call.api-gateway
[1589392416532] [DEBUG] 2020-05-13T17:53:36.532Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
[1589392416547] [DEBUG] 2020-05-13T17:53:36.547Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
[1589392416547] [DEBUG] 2020-05-13T17:53:36.547Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
[1589392416547] [DEBUG] 2020-05-13T17:53:36.547Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
[1589392416548] [DEBUG] 2020-05-13T17:53:36.548Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
[1589392416568] [DEBUG] 2020-05-13T17:53:36.567Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
[1589392416568] [DEBUG] 2020-05-13T17:53:36.568Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
[1589392416568] [DEBUG] 2020-05-13T17:53:36.568Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
[1589392416568] [DEBUG] 2020-05-13T17:53:36.568Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
[1589392416572] [DEBUG] 2020-05-13T17:53:36.571Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Looking for credentials via: env
[1589392416572] [INFO] 2020-05-13T17:53:36.572Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Found credentials in environment variables.
[1589392416573] [DEBUG] 2020-05-13T17:53:36.573Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Loading JSON file: /var/runtime/botocore/data/endpoints.json
[1589392416609] [DEBUG] 2020-05-13T17:53:36.608Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Event choose-service-name: calling handler <function handle_service_name_alias at 0x7f582245f158>
[1589392416631] [DEBUG] 2020-05-13T17:53:36.630Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Loading JSON file: /var/runtime/botocore/data/lambda/2015-03-31/service-2.json
[1589392416648] [DEBUG] 2020-05-13T17:53:36.648Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Event creating-client-class.lambda: calling handler <function add_generate_presigned_url at 0x7f582252d8c8>
[1589392416668] [DEBUG] 2020-05-13T17:53:36.668Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Setting lambda timeout as (60, 60)
[1589392416669] [DEBUG] 2020-05-13T17:53:36.669Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Loading JSON file: /var/runtime/botocore/data/_retry.json
[1589392416670] [DEBUG] 2020-05-13T17:53:36.670Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Registering retry handlers for service: lambda
[1589392416674] [DEBUG] 2020-05-13T17:53:36.670Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Event choose-service-name: calling handler <function handle_service_name_alias at 0x7f582245f158>
[1589392416674] [DEBUG] 2020-05-13T17:53:36.671Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Loading JSON file: /var/runtime/botocore/data/sns/2010-03-31/service-2.json
[1589392416674] [DEBUG] 2020-05-13T17:53:36.673Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Event creating-client-class.sns: calling handler <function add_generate_presigned_url at 0x7f582252d8c8>
[1589392416688] [DEBUG] 2020-05-13T17:53:36.687Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Setting sns timeout as (60, 60)
[1589392416689] [DEBUG] 2020-05-13T17:53:36.688Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Registering retry handlers for service: sns
[1589392416707] [DEBUG] 2020-05-13T17:53:36.707Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Event choose-service-name: calling handler <function handle_service_name_alias at 0x7f582245f158>
[1589392416708] [DEBUG] 2020-05-13T17:53:36.708Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Loading JSON file: /var/runtime/botocore/data/sts/2011-06-15/service-2.json
[1589392416709] [DEBUG] 2020-05-13T17:53:36.709Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Event creating-client-class.sts: calling handler <function add_generate_presigned_url at 0x7f582252d8c8>
[1589392416711] [DEBUG] 2020-05-13T17:53:36.711Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Setting sts timeout as (60, 60)
[1589392416712] [DEBUG] 2020-05-13T17:53:36.712Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Registering retry handlers for service: sts
[1589392416712] [DEBUG] 2020-05-13T17:53:36.712Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Event choose-service-name: calling handler <function handle_service_name_alias at 0x7f582245f158>
[1589392416713] [DEBUG] 2020-05-13T17:53:36.713Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Loading JSON file: /var/runtime/botocore/data/dynamodb/2012-08-10/service-2.json
[1589392416748] [DEBUG] 2020-05-13T17:53:36.747Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Event creating-client-class.dynamodb: calling handler <function add_generate_presigned_url at 0x7f582252d8c8>
[1589392416750] [DEBUG] 2020-05-13T17:53:36.749Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Setting dynamodb timeout as (60, 60)
[1589392416751] [DEBUG] 2020-05-13T17:53:36.750Z e4fe02dc-8707-42ec-b9c8-927722bbe9da Registering retry handlers for service: dynamodb
[1589392417287] /var/task/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
[1589392417287] """)
[1589392417375] /var/task/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
[1589392417375] """)
[1589392420473] [DEBUG] 2020-05-13T17:53:40.473Z 87a3402e-83c0-46c4-8321-83dfb5894ac4 Zappa Event: {'time': '2020-05-13T17:52:45Z', 'detail-type': 'Scheduled Event', 'source': 'aws.events', 'account': '305248833490', 'region': 'ap-south-1', 'detail': {}, 'version': '0', 'resources': ['arn:aws:events:ap-south-1:305248833490:rule/4cc28a00df50496a4bbc3925ba41efa0a6d64-handler.keep_warm_callback'], 'id': '3033db8b-a8db-d250-7aa3-62d57ac09bab', 'kwargs': {}}

什么是

1) 导入 XYZPlugin

2) 将事件名称从 X 更改为 Y

3)加载JSON文件:

4) 事件创建-client-class.sns:调用处理程序

标签: pythonamazon-web-servicesaws-lambdazappa

解决方案


推荐阅读