Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/expecho/semanticlogging.database.xml

SemanticLogging.Database.Xml is a sink for the Semantic Logging Application Block that exposes Event Source events to an Sql Server database. The payload data is stored in an xml document instead of a Json document
https://github.com/expecho/semanticlogging.database.xml

etw eventsource logging semantic-logging sql-server sql-server-database sqlserver structured-logging xml

Last synced: about 23 hours ago
JSON representation

SemanticLogging.Database.Xml is a sink for the Semantic Logging Application Block that exposes Event Source events to an Sql Server database. The payload data is stored in an xml document instead of a Json document

Awesome Lists containing this project

README

        

## XmlSqlDatabaseSink
XmlSqlDatabaseSink is a sink for the [Semantic Logging Application Block](https://msdn.microsoft.com/en-us/library/dn775014(v=pandp.20).aspx) that exposes Event Source events to an Sql Server database.
The default database sink uses a Json document to store the payload data whereas this sink uses an xml document to store the payload data.

This sink is also available as a Nuget package: https://www.nuget.org/packages/SemanticLogging.Database.Xml/

## Usage
Usage is the same as with the default database sink. This sink provides one additional parameter to provide the name of the stored procedure
that is used to insert the datarecords. This makes it possible to use multiple XmlSqlDatabaseSink instances that writes to different tables:

```c#
var listener1 = new ObservableEventListener();
listener1.LogToSqlDatabase
(
Environment.MachineName,
@"data source=.\sql2012;initial catalog=SinkTests;integrated security=True",
bufferingInterval: TimeSpan.FromSeconds(5),
tableName: "Others",
storedProcedureName: "WriteOthers"
);
listener1.EnableEvents(MyEventSource1.Log, EventLevel.LogAlways);

var listener2 = new ObservableEventListener();
listener2.LogToSqlDatabase
(
Environment.MachineName,
@"data source=.\sql2012;initial catalog=SinkTests;integrated security=True",
bufferingInterval: TimeSpan.FromSeconds(5),
tableName: "Sessions",
storedProcedureName: "WriteSessions"
);
listener2.EnableEvents(MyEventSource2.Log, EventLevel.LogAlways);
```
## Query payload

Since the payload is stored in an xml column it is easy to query, for example:

```sql
SELECT
FormattedMessage,
Payload.value('(/Payload/sampleProperty/text())[1]', 'nvarchar(100)') as member,
FROM Traces
```

## Out-of-process logging

A sample configuration for out-of-process logging using a windows service (see https://msdn.microsoft.com/en-us/library/dn774996(v=pandp.20).aspx):

```xml








```

## How do I contribute?

Please see [CONTRIBUTE.md](/CONTRIBUTE.md) for more details.