Slide 61
Slide 61 text
#pyconjp_3
2021-10-01 13:22:26.84618a54970-32ad-4484-9650-167ed4c7b777
lambda_function.py:main:25 [INFO]{'key1': 'value1', 'key2': 'value2', 'key3': 'value3'}
2021-10-01 13:22:26.84618a54970-32ad-4484-9650-167ed4c7b777
lambda_function.py:main:26 [INFO]{'aws_request_id':
'18a54970-32ad-4484-9650-167ed4c7b777', 'log_group_name':
'/aws/lambda/pycon-jp-2021_test_logging', 'log_stream_name':
'2021/10/01/[$LATEST]0f2d935e588b4cf1be2a734049dca4e5', 'function_name':
'pycon-jp-2021_test_logging', 'memory_limit_in_mb': '128', 'function_version': '$LATEST',
'invoked_function_arn':
'arn:aws:lambda:ap-northeast-1:123456789012:function:pycon-jp-2021_test_logging',
'client_context': None, 'identity': <__main__.CognitoIdentity object at 0x7f4836e986d0>,
'_epoch_deadline_time_in_ms': 1633094556845}
61
def main(event, context):
logger = logging.getLogger(__name__)
logger.info(event)
logger.info(vars(context)) # コンテキストを出力して aws_request_id を確認
👉