How to hide or mask paths from "Microsoft.Hosting.Lifetime" traces using serilog in the appsetting for an API project.
Having this configuration:
I want to hide the information about the content path, etc in the log:
Let me know if you know how to do it.
Having this configuration:
JavaScript:
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Enrich": [ "FromLogContext", "WithMachineName", "WithProcessId", "WithThreadId", "WithSensitiveDataMasking" ],
"WriteTo": [
{ "Name": "Console" },
{
"Name": "File",
"Args": {
"path": "*****",
"fileSizeLimitBytes": 1000000,
"rollOnFileSizeLimit": true,
"shared": true,
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} {Level} {MachineName} {ProcessId} {Message}{NewLine:l}{Exception:l}"
}
}
]
}
I want to hide the information about the content path, etc in the log:
C#:
[16:46:13 INF] Application Starting
[16:46:13 INF] User profile is available. Using 'C:\Users\user\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
[16:46:14 INF] Now listening on: https://localhost:44301
[16:46:14 INF] Application started. Press Ctrl+C to shut down.
[16:46:14 INF] Hosting environment: Local
[16:46:14 INF] Content root path: C:\Users\user\Documents\SPM\Projects\SPM-api_branch_Initial_work\src\SPMAPI
Let me know if you know how to do it.
Last edited by a moderator: