0

How can i store audit data in azure table storage,audit.net provides (https://github.com/thepirat000/Audit.NET#data-providers-included) sqldataprovider only can you please help me.

Thanks

  • 1
    Write your own `AuditDataProvider` - https://github.com/thepirat000/Audit.NET/blob/master/src/Audit.NET.SqlServer/Providers/SqlDataProvider.cs – Alex Jul 05 '18 at 09:30
  • Hi alex I created a custom audit data provider,thanks for help. – vinodshetty Jul 06 '18 at 13:37
  • 1
    I will create a configurable Azure Table data provider soon and add it as an extension. Actually it will be part of the `Audit.NET.AzureStorage` package. – thepirat000 Jul 07 '18 at 05:38

2 Answers2

0

Now you can use the Azure Table data provider to store your audit events on azure tables. It is included from version 12.1.9 on the Audit.NET.AzureStorage package.

You can configure the columns dynamically via an anonymous object or dictionary, or implementing your own TableEntity class.

For example:

Audit.Core.Configuration.Setup()
    .UseAzureTableStorage(_ => _
        .ConnectionString("your cnn string")
        .TableName("Events")
        .EntityBuilder(e => e
            .PartitionKey($"Events{ev.StartDate:yyyyMM}")
            .Columns(c => c.FromObject(ev => new 
            { 
                Date = ev.StartDate, 
                User = ev.Environment.UserName, 
                ... 
            }))));

Take a look at the README file here.

For further problems, note you can also open an issue instead of asking on SO. or ask on the Audit.NET Gitter chat

thepirat000
  • 12,362
  • 4
  • 46
  • 72
  • Thanks @thepirat000,but i wrote my custom provider Audit.Core.Configuration.DataProvider = new AzureTableDataprovider() { ConnectionString = ConfigurationManager.ConnectionStrings["AuditDbConnection"].ToString(), Schema = "dbo", TableName = "tblbateventsauditing", IdColumnName = "EventId", JsonColumnName = "Data" }; – vinodshetty Jul 11 '18 at 13:47
0
  Audit.Core.Configuration.DataProvider = new AzureTableDataprovider()
        {
            ConnectionString = ConfigurationManager.ConnectionStrings["AuditDbConnection"].ToString(),
            Schema = "dbo",
            TableName = "tblbateventsauditing",
            IdColumnName = "EventId",
            JsonColumnName = "Data"
        };