Comments (5)
Looks like you're getting a timeout from cosmosDB when trying to save the audit event.
Is your audit event too large?
Have you seen Diagnose and troubleshoot Azure Cosmos DB .NET SDK request timeout exceptions? Maybe you need to customize the timeout.
from audit.net.
You could be right about the audit event size. I'll dive into that.
Is there any way I could catch the Exception? So, I can log the exception and continue.
from audit.net.
Also, you could implement your own data provider, by inheriting from AzureCosmosDataProvider
and adding your custom try/catch mechanism in the Insert Audit Event logic.
For example:
public class AzureCosmosCustomProvider : AzureCosmosDataProvider
{
public AzureCosmosCustomProvider() : base() { }
public AzureCosmosCustomProvider(Action<IAzureCosmosProviderConfigurator> config) : base(config) { }
public override object InsertEvent(AuditEvent auditEvent)
{
try
{
return base.InsertEvent(auditEvent);
}
catch (CosmosException ex) when (ex.StatusCode == HttpStatusCode.RequestTimeout)
{
// timed out
return null;
}
}
public override async Task<object> InsertEventAsync(AuditEvent auditEvent, CancellationToken cancellationToken = default)
{
try
{
return await base.InsertEventAsync(auditEvent, cancellationToken);
}
catch (CosmosException ex) when (ex.StatusCode == HttpStatusCode.RequestTimeout)
{
// timed out
return null;
}
}
}
Then you can set up the data provider like this:
Audit.Core.Configuration.Setup()
.Use(new AzureCosmosCustomProvider(_ => _
.Endpoint(...)
.Database(...)
.Container(...)
.AuthKey(...)));
from audit.net.
If you're looking for a retry mechanism. check this: #372 (comment)
from audit.net.
A big thanks, your suggestions will solve my issue 👍
from audit.net.
Related Issues (20)
- Question for WebApi: Audit only on statuscodes HOT 2
- How to use WebApi / Serilog with .Net 4.7.2 HOT 9
- Extra Double Quote in PostgreSqlDataProvider Generated SQL HOT 2
- Since the new version of mongo-csharp-driver The Jobject for AuditTarget cannot be serialized/deserialized HOT 2
- AuditCommandInterceptor IncludeReaderResults = true results in "DataReader Open" error HOT 9
- Missing Method Exception: Microsoft.EntityFrameworkCore.Metadata.IEntityType.GetProperties() HOT 3
- Best way to "Include" related entity properties HOT 3
- Audit.EntityFramework.Core add support for EF8 Complex Types HOT 1
- Feature Request: New MongoDB interaction extension to audit a MongoDB .NET Driver instance HOT 1
- How to audit entities that have been changed\deleted because of on cascade behavior? HOT 13
- How to ingest data to AzureTableStorage month wise in the AuditTrail implementation using Audit.NET? HOT 2
- Not available to use dbContext in .UseDbContext<MyDbContext> in Audit.Core.Configuration.Setup HOT 6
- Feature Request - Enable configuration of Azure Blob Storage Tags HOT 3
- CosmoDB & EFCore: Storing document per entry instead of per transation. HOT 4
- Logs to ElasticSearch missing full information from version 23.0.0 HOT 3
- Possibility to set and save the AuditEvent from an external source HOT 2
- Store data to common audit table HOT 5
- How to connect AzureTableStorage using UserAssigned ManagedIdentity in the AuditTrail implementation using Audit.NET? HOT 1
- Add custom value to audit workflow HOT 2
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 audit.net.