Closed DaveParr closed 4 years ago
DW, worked it out from how you treat EVENT_DATA
and how rust pulls it from the environment variable. Looks like behind the actual python object I am used to using, the info I need is just accessible from System level variables like so:
print(Sys.getenv("AWS_LAMBDA_LOG_STREAM_NAME"))
I see that in the runtime you create the
EVENT_DATA
fromevent_response
which is driven from theevent_url
:https://github.com/bakdata/aws-lambda-r-runtime/blob/fd664b3027e578425be5cd1607a3d8522ca2913f/runtime/src/runtime.R#L91-L92
Would this also expose the
context
of the invocation? Specifically thelog_stream_name
as outlined here in python? How would I access that? What would the variable be called?https://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html
I have a use case where I need to pass this
log_stream_name
over to the client system to log to help them with bug fixing. I'm looking for a variable that is a string set at a cold start similar to:2019/12/10/[$LATEST]dc1cbcfbd4a24f0e9abcd3c8d44bc041
Any suggestions as to how I can access that from my lambda logic?
N.B I don't believe (maybe wrongly), that this is the
"requestContext"
of the body of the event. I've only seen that have info about the account id, and request id, but never (yet) the cloud watch log stream name mentioned in the docs above.This may not be helpful, but I've found a rust custom runtime which seems to be an example of what I'm looking for, creating a string called
log_stream_name
:https://github.com/awslabs/aws-lambda-rust-runtime/blob/master/lambda-runtime-core/src/context.rs