Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@requestId is not logged for metrics log line when using in Lambda #101

Open
heartsword2017 opened this issue May 13, 2022 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@heartsword2017
Copy link

heartsword2017 commented May 13, 2022

Hi,

I am using this library in my Lambda to log custom metrics. When using it, I observe for the EMF log line it will add those Lambda autogenerated fields like @ingestionTime, @logstream, @message, @timestamp and etc but @requsetId is missing from it. Other normal log lines generated from code will always have @requestid.

The problem caused is when we use log Insight to search for all logs of a specific Lambda invocation by filter @requestId = "something", with @requestid missed on this line, it won't show up in search result.

See the picture for details.
@requestid is missed
1

when searching logs with @requestid, EMF log line is not included due to missing @requestid
2

Do we think this is something we can fix?

@heartsword2017
Copy link
Author

heartsword2017 commented Jul 17, 2022

@paggynie Hi, I have already tried that. So

  • If I use putProperty to set requestID ( and I use "@requestid" as key to mimic other Lambda system properties), in the logInsight search, it will actually show as "@@requestid", double "@" so that's still not going to work.
  • If I use just "requestId" without "@", it will be a normal key.
    The 2nd method is a workaround as I can definitely do filter @requestid = "blabla" or requestId = "blabla" to get all logs but this is not a decent solution.

I have actually already talked to the PE @jaredcnance on this and he said the problem is because EMF library cannot get the requestId from env variable because it's coming from the request Object. He suggested there is some backend processing of the Lambda logs in Cloudwatch that you guys can try extract the RequestId and expose as a system field @requestid so later EMF can publish it? This is some deep log processing between Lambda and CW which I aren't too familiar with, what do you think?

@markkuhn markkuhn added the enhancement New feature or request label Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants