Closed SViradiya-MarutiTech closed 1 year ago
I tried below, but no luck
{
"Serilog": {
"Enrich": {
"WithSensitiveDataMasking": {
"Name": "WithSensitiveDataMasking",
"Args": {
"SensitiveDataEnricherOptions": {
"Mode": "Globally",
"ExcludeProperties": [
"email"
],
"MaskValue": "^^"
}
}
}
}
}
}
Because configuration of the enricher uses an options
lambda it's not possible to use the currently supported configuration for the enricher via JSON as you can't "serialize" something like: options => options.MaskValue = "CUSTOM";
to JSON.
Turned out to be not super hard: https://github.com/serilog-contrib/Serilog.Enrichers.Sensitive#json-configuration
Will be in package release 1.7.0 which should appear on NuGet shortly.
@sandermvanvliet Thanks a lot..
Can we add Custom masking operators, as in latest release, you have provided Custom masking on Email. but I am thinking to add in MakingOperators list, So is it possible?
{
"Serilog": {
"Using": [
"Serilog.Enrichers.Sensitive"
],
"Enrich": [
{
"Name": "WithSensitiveDataMasking",
"Args": {
"options": {
"MaskValue": "CUSTOM_MASK_FROM_JSON",
"ExcludeProperties": [
"email"
],
"MaskingOperators":["My.Assembly.Name.CustomMaskingOperator"],
"Mode": "Globally"
}
}
}
]
}
}
We are not doing hard code C# hard code configuration in Startup/Program.cs, we have stored JSON Configuration of Serilog in AWS SSM, So to apply this Enrichers, how can I transform or configure below code in JSON?
I able to Set Enricher in Serilog JSON Configuration like below. I am using other Enrichers as JSON configuration only.
but not able to transform other proprties.