Replies: 2 comments
-
Hi @JasonBock. There isn't a mechanism right now to provide your own formatter. I need to double check how flexible the Lambda service can be on the format. I'm pretty sure they do require some fields to be in a certain locations for their analytics. |
Beta Was this translation helpful? Give feedback.
-
@normj that would be disappointing. We have a standard JSON format for all of our log messages, and not being able to format a log message to meet that need is a hindrance. That said, would using AWS Powertools be a possible solution? Reading up on it, it seems like we'd still have to write a custom formatter specifically for Powertools (https://docs.powertools.aws.dev/lambda/dotnet/core/logging/#custom-log-formatter-bring-your-own-formatter), but it would let us log using our structure. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Where I work, we have a custom log formatter defined that inherits from
ConsoleFormatter
. This lets us log our content based on an internal standard that uses a JSON format for data configured in a specific way. This works great for console applications, web apps using Blazor, apps hosted in k8s, etc. However, with an AWS Lambda, we can't find a way to get a lambda to use our custom formatter, even when we explicitly configure .NET logging to use our formatter. Seems like AWS lambda infrastructure just ignores that, and only "Text" or "Json" are the only way log in a lambda. There seems like there might be an alternative option in using AWS Powertools, but that would require our lambda users to use Powertools and it also seems like we'd have to build another formatter just for Powertools.So, long story short: is there a way to use a custom .NET log formatter in a lambda?
Beta Was this translation helpful? Give feedback.
All reactions