Comments (4)
Create a derived class MsSqlErrorLogWithoutSensitiveInformation
public class MsSqlErrorLogWithoutSensitiveInformation : SqlErrorLog
{
private List<String> sensitiveKeys = new List<string>() { "password", "pwd" };
public MsSqlErrorLogWithoutSensitiveInformation(IOptions<ElmahOptions> option) : base(option)
{
}
public MsSqlErrorLogWithoutSensitiveInformation(string connectionString, string schemaName, string tableName) : base(connectionString, schemaName, tableName)
{
}
public override string Log(Error error)
{
var formKeys = error.Form.AllKeys;
if (formKeys != null)
{
foreach (var key in formKeys)
{
if (sensitiveKeys.Any(sk => key?.IndexOf(sk, StringComparison.OrdinalIgnoreCase) >= 0))
{
error.Form.Set(key, "******************");
if (error.Form.AllKeys.Contains("$request-body"))
{
error.Form.Remove("$request-body");
}
}
}
}
return base.Log(error);
}
}
On Program.cs remove reference to SQLErrorLog and add reference to a derived class MsSqlErrorLogWithoutSensitiveInformation
builder.Services.AddElmah<MsSqlErrorLogWithoutSensitiveInformation>(options =>
{
options.ConnectionString = builder.Configuration.GetConnectionString("ConnectionName");
options.SqlServerDatabaseTableName = "ErrorLogs"; //Defaults to ELMAH_Error if not set
options.Path = "errorlogs";
options.OnPermissionCheck = context => context.User.Identity.IsAuthenticated;
});
That's it!!!
from elmahcore.
Any resolution on this? @Sarojsigdel did you find anything?
from elmahcore.
from elmahcore.
Are you able to share? Is it documented as a different issue? code snippet etc?
Thank you!
from elmahcore.
Related Issues (20)
- High CPU usage when a specific log appear HOT 1
- is publish package available
- Elmah Generates Error Request did not match any endpoints
- ElmahCore.Mvc.ErrorWrapper IsMobile method requires length check
- UI - Scrollbar not showing until window resize
- Possible to disable connections to ip-api.com? HOT 1
- ElmahCore in ASPNET Core 7 Web API throws 404 /favicon.ico Not Found error... HOT 6
- Out Of Memory Exception
- The log file path can't change to my desired path HOT 1
- Secure error page without authentication? HOT 1
- 2.2 Version Available in the NuGet Package? HOT 3
- UI not coming up with React SPA
- How to remove Source tab in the ElmahCore Dashboard
- Remove SqlLogs from AllXml?
- Notifiers (and probably Filters as well) should be registered through Dependency Injection HOT 1
- Very slow ErrorDetailHelper.MarkupStackTrace call with text from in a docker container.
- Repo & project link wrong way around
- Set license expression on nuget packages
- Optimise dependencies by using frameworks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elmahcore.