Totallytech.LogService 1.0.2.18

Central Log System README

This README provides instructions on configuring a central log system in your ASP.NET Core application based on the specified location.

LogConfig Structure using OpenTelematory

The LogConfig structure defines the configuration settings for the central log system. Depending on the specified location, different configurations may be required.

"LogConfig": {
  "Location": "Seq",
  "LogFilePath": "/logs",
  "ServiceName": "Your Service Name",
  "LogEventLevel": 2,
  "SqlServerConnectionString": "",
  "SeqConfiguration": {
    "ServerUrl": "<your seq server address option if not specified already default is configured>",
    "ApiKey": "",
    "HasMetrics":false
  },
  "ZipkinEndpoint":"",
  // by default seq oltp is enabled to add Extra additional exporters
  "OtlpExporters":[
      {
        "Endpoint": "",
        "Protocol": "grpc",
        "Headers": "",
      }
  ],
  "RabbitMQConfig": {
    "HostName": "",
    "UserName": "",
    "Password": "",
    "VirtualHost": "/",
    "Port": 5671,
    "SslEnabled": false,
    "ServerName": "",
    "QueueName": ""
  },
  "ElasticConfiguration": {
    "Uri": ""
  }
}

🔐 OTLP Exporter Headers Examples

Backend Header Example
Honeycomb x-honeycomb-team=your-api-key
New Relic api-key=YOUR_API_KEY
Grafana Cloud Authorization=Basic <base64 encoded user:token>
Elastic APM Authorization=Bearer YOUR_TOKEN
Seq X-Seq-ApiKey=ApiKey

  • Protocol: Protocol used for otlpExporters. Possible values:

    • http/protobuf
    • grpc
  • Location: Location of the central log system. Possible values:

    • Seq
    • File
    • RabbitMQ
    • SqlServer
    • ElasticDb
  • LogEventLevel: LogEventLevel of the central log system. Possible values (use numeric value default is Information (2)):

    • 0 ->Verbose
    • 1 ->Debug
    • 2 ->Information
    • 3 ->Warning
    • 4 ->Error
    • 5 -> Fatal
  • LogFilePath: Path where log files are stored (if applicable).

  • ServiceName: Name of your service.

  • LogEventLevel: Level where log Event Level are defined (if applicable).

  • SqlServerConnectionString: Connection string for SQL Server logging (if applicable).

  • SeqConfiguration: Configuration for Seq logging (if applicable).

  • RabbitMQConfig: Configuration for RabbitMQ logging (if applicable).

  • ElasticConfiguration: Configuration for Elasticsearch logging (if applicable).

Serilog with OpenTelematory Configuration

Use the provided middleware and setup in your application to configure OpenTelematory with the specified settings.

    builder.Services.AddCustomTelemetry(builder, builder.Configuration);

Serilog Configuration

Use the provided middleware and setup in your application to configure Serilog with the specified settings.

builder.Host.UseSerilog((context, loggerConfiguration) => 
    Logging.Library.Extensions.SeriLogger.Configure(context, loggerConfiguration));

Enable Tracing use Code in .net8 or later

builder.Service.AddTracing(IHostApplicationBuilder builder, IConfiguration configuration);

Additional Middleware

Add middleware to log HTTP session information.

app.UseSerilogHttpSessionsLogging(HttpSessionInfoToLog.All);

Logging Response Body

If you want to log response bodies, set AllowGetResponse to true.

Conclusion

By following the steps outlined in this README and configuring the central log system based on the specified location, you can effectively manage and monitor logs for your ASP.NET Core application. This centralized logging approach helps streamline log management and enhances visibility into application behavior and performance.

No packages depend on Totallytech.LogService.

.NET 6.0

.NET 8.0

.NET 7.0

Version Downloads Last updated
1.0.2.20 63 7/16/2025
1.0.2.19 57 5/10/2025
1.0.2.18 9 5/10/2025
1.0.2.17 11 5/1/2025
1.0.2.16 14 4/30/2025
1.0.2.15 11 4/30/2025
1.0.2.14 12 4/30/2025
1.0.2.13 8 4/30/2025
1.0.2.12 12 4/30/2025
1.0.2.11 10 4/30/2025
1.0.2.10 12 4/29/2025
1.0.2.9 52 4/12/2025
1.0.2.8 11 4/12/2025
1.0.2.7 12 4/12/2025
1.0.2.6 7 4/12/2025
1.0.2.5 12 4/12/2025
1.0.2.4 16 2/20/2025
1.0.2.3 91 9/15/2024
1.0.2.2 39 6/15/2024
1.0.2.1 12 6/13/2024
1.0.2 87 6/9/2024
1.0.1 74 5/29/2024
1.0.0 77 5/26/2024