Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/sumologic/sumologic-net-appenders

Several appenders for .NET developers to use that send logs straight to SumoLogic.
https://github.com/sumologic/sumologic-net-appenders

Last synced: 6 days ago
JSON representation

Several appenders for .NET developers to use that send logs straight to SumoLogic.

Awesome Lists containing this project

README

        

# Sumo Logic .NET Appenders

[![Build status](https://ci.appveyor.com/api/projects/status/fnfnxdoanv5aux3f?svg=true)](https://ci.appveyor.com/project/bin3377/sumologic-net-appenders)
[![SumoLogic.Logging.Common](https://img.shields.io/nuget/v/SumoLogic.Logging.Common.svg?label=SumoLogic.Logging.Common&logo=nuget&logoColor=C0C0C0)](https://www.nuget.org/packages/SumoLogic.Logging.Common/)
[![SumoLogic.Logging.Log4Net](https://img.shields.io/nuget/v/SumoLogic.Logging.Log4Net.svg?label=SumoLogic.Logging.Log4Net&logo=nuget&logoColor=C0C0C0)](https://www.nuget.org/packages/SumoLogic.Logging.Log4Net/)
[![SumoLogic.Logging.NLog](https://img.shields.io/nuget/v/SumoLogic.Logging.NLog.svg?label=SumoLogic.Logging.NLog&logo=nuget&logoColor=C0C0C0)](https://www.nuget.org/packages/SumoLogic.Logging.NLog/)
[![SumoLogic.Logging.Serilog](https://img.shields.io/nuget/v/SumoLogic.Logging.Serilog.svg?label=SumoLogic.Logging.Serilog&logo=nuget&logoColor=C0C0C0)](https://www.nuget.org/packages/SumoLogic.Logging.Serilog/)
[![SumoLogic.Logging.AspNetCore](https://img.shields.io/nuget/v/SumoLogic.Logging.AspNetCore.svg?label=SumoLogic.Logging.AspNetCore&logo=nuget&logoColor=C0C0C0)](https://www.nuget.org/packages/SumoLogic.Logging.AspNetCore/)

Appenders for .NET logging frameworks which send data to Sumo Logic HTTP sources.

## Prerequisites

- .NET 4.5 or later or .NET Standard 1.5
- ASP.NET Core 2.0 or later for ASP.NET Core Logging provider
- A Sumo Logic Account (trial can be started [here](https://www.sumologic.com/))

## Appenders

Appenders are provided for the following .NET logging frameworks

- NLog
- Log4Net
- Serilog
- ASP.NET Core Logging Provider (Beta)

All appenders have two implementations: a buffering and a non-buffering version.
The non-buffering implementations will send each log message to Sumo Logic in a distinct HTTP request. The buffering
implementations will queue messages until a size, count, or time threshold is met, then send in batch.

## NuGet Installation

### NLog

To install the NLog target, use the following steps

```ps
Install-Package SumoLogic.Logging.NLog
```

#### Example Appender Configuration for NLog

```xml






https://collectors.us2.sumologic.com/receiver/v1/http/==your_endpoint_here==
30000
ExampleNameNLogTarget
ExampleCategoryNLogTarget
ExampleHostNLogTarget
true


https://collectors.us2.sumologic.com/receiver/v1/http/==your_endpoint_here==
ExampleNameNLogBufferedTarget
ExampleCategoryNLogBufferedTarget
ExampleHostNLogBufferedTarget
30000
5000
10
10000
250
500000
true





```

#### Example Code For NLog

```csharp
public static class Program
{
///
/// An example application that logs.
///
public static void Main()
{
Logger logger = LogManager.GetCurrentClassLogger();
logger.Debug("Log message");
Console.Read();
}
}
```

More about NLog target configuration: [SumoLogic.Logging.NLog](docs/sumologic.logging.nlog.md)

### Log4Net

To install the Log4Net appender, use the following steps:

```ps
Install-Package SumoLogic.Logging.Log4Net
```

#### Example Appender Configuration for Log4Net

```xml











































```

#### Example Code for Log4Net

```csharp
public static class Program
{
///
/// The log4net log.
///
private static ILog log4netLog = LogManager.GetLogger(typeof(Program));

///
/// An example application that logs.
///
public static void Main()
{
Console.WriteLine("Hello world!");
log4netLog.Info("Hello world!");
Console.ReadKey();
}
}
```

More about Log4Net appender configuration: [SumoLogic.Logging.Log4Net](docs/sumologic.logging.log4net.md)

### Serilog

To install the Serilog sink, use the following steps:

```ps
Install-Package SumoLogic.Logging.Serilog
```

#### Example Code (instantiation and configuration)

```csharp
Logger log = new LoggerConfiguration()
.WriteTo.BufferedSumoLogic(
new Uri("https://collectors.us2.sumologic.com/receiver/v1/http/==your_endpoint_here=="),
sourceName: "ExampleNameSerilogBufferedSink",
sourceCategory: "ExampleCategorySerilogBufferedSink",
sourceHost: "ExampleHostSerilogBufferedSink",
connectionTimeout: 30000,
retryInterval: 5000,
messagesPerRequest: 10,
maxFlushInterval: 10000,
flushingAccuracy: 250,
maxQueueSizeBytes: 500000)
.CreateLogger();

log.Information("Hello world!");
```

More about Serilog sink configuration: [SumoLogic.Logging.Serilog](docs/sumologic.logging.serilog.md)

### ASP.NET Core Logging Provider

To install the logging provider, use the following steps:

```ps
Install-Package SumoLogic.Logging.AspNetCore
```

More about ASP.NET Core logging provider configuration: [SumoLogic.Logging.AspNetCore](docs/sumologic.logging.aspnetcore.md)

## TLS 1.2 Requirement

Sumo Logic only accepts connections from clients using TLS version 1.2 or greater. To utilize the content of this repo, ensure that it's running in an execution environment that is configured to use TLS 1.2 or greater.

## License

[Apache 2.0](LICENSE)