Skip to content

Instantly share code, notes, and snippets.

@mt8
Last active October 4, 2017 10:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mt8/2618e9db37145fb1ea09908a660f343c to your computer and use it in GitHub Desktop.
Save mt8/2618e9db37145fb1ea09908a660f343c to your computer and use it in GitHub Desktop.
[AWS] Lambdaで出力したCloudWatchログのログストリームURLをLambda内で取得するPython(エラー調査などに便利)
def lambda_handler(event, context):
region = context.invoked_function_arn.split(":")[3]
request_id = context.aws_request_id
log_group_name = context.log_group_name
log_stream_name = context.log_stream_name
log_url = "https://"+region+".console.aws.amazon.com/cloudwatch/home?region="+region+"#logEvent:group="+log_group_name+";stream="+log_stream_name
print log_url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment