Skip to content

RFC: Add Filtering to the Powertools Logging Feature  #497

@amirkaws

Description

@amirkaws

Is this related to an existing feature request or issue?

No response

Which Powertools for AWS Lambda (.NET) utility does this relate to?

Logging

Summary

When using Powertools Logger, include filters to include or exclude logs under certain conditions

Use case

Include or exclude log entries under a certain conditions such as

  • Ignore when message contains a text, or
  • Log only when message matches a regular expressions

Proposal

Suggestion

Logger.AddFiter(fiterExpression);
Logger.AddFiters(fiterExpression1, fiterExpression2);

Just a suggestion for filter class

public class LoggerFilterExpression
{
     public LogAction Action { get; set; } // Enum value of Exclude, IncludeOnly, ...
     public string Expression { get; set; } // ex: Contains('Hello'), NotOnly, JMESPath, etc.
}

Out of scope

Anything which is not mentioned in the Summary and Proposal sections.

Potential challenges

TBD

Dependencies and Integrations

No response

Alternative solutions

Extending powertools logger to include the required functionality

Acknowledgment

Metadata

Metadata

Assignees

Labels

RFCTechnical design documents related to a feature requestarea/loggingCore logging utilityfeature-requestNew or enhancements to existing featuresreleasedFix or implementation already in main and releasedv2v2 release

Type

No type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions