Skip to content

Commit 6b150ce

Browse files
committed
Cleanup + README.MD
1 parent 6ed03a9 commit 6b150ce

File tree

3 files changed

+10
-39
lines changed

3 files changed

+10
-39
lines changed

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ You can find more information about what Loki is over on [Grafana's website here
3636
## Features:
3737
- Formats and batches log entries to Loki via HTTP (using actual API)
3838
- Global and contextual labels support
39-
- Labels filtration modes
39+
- Flexible Loki labels configuration possibilities
40+
- Collision avoiding mechanism for labels
4041
- Integration with Serilog.Settings.Configuration
4142
- Customizable HTTP clients
4243
- HTTP client with gzip compression
@@ -94,7 +95,9 @@ Used in conjunction with [Serilog.Settings.Configuration](https://github.com/ser
9495
"value": "web_app"
9596
}
9697
],
97-
"outputTemplate": "{Timestamp:dd-MM-yyyy HH:mm:ss} [{Level:u3}] [{ThreadId}] {Message}{NewLine}{Exception}"
98+
"propertiesAsLabels": [
99+
"app"
100+
]
98101
}
99102
}
100103
]
@@ -136,7 +139,10 @@ Log.Logger = new LoggerConfiguration()
136139
```
137140

138141
### Sending json content to Loki
139-
Serilog.Sinks.Grafana.Loki can be configured to send json content to Loki, this enables easier filtering in Loki v2, more information about how to filter can be found [here](https://grafana.com/blog/2020/10/28/loki-2.0-released-transform-logs-as-youre-querying-them-and-set-up-alerts-within-loki/)
142+
From v8 Serilog.Sinks.Grafana.Loki uses `LokiJsonTextFormatter` by default, which allows to send logs to Loki as a JSON-payloads. This allows easier filtering in Loki v2, more information about how to filter can be found [here](https://grafana.com/blog/2020/10/28/loki-2.0-released-transform-logs-as-youre-querying-them-and-set-up-alerts-within-loki/)
143+
144+
Also, you could implement your own formatter, implementing `Serilog.Formatting.ITextFormatter` interface and pass it to the sink configuration.
145+
140146
Example configuration:
141147
```json
142148
{
@@ -152,7 +158,7 @@ Example configuration:
152158
"Name": "GrafanaLoki",
153159
"Args": {
154160
"uri": "http://localhost:3100",
155-
"textFormatter": "Serilog.Sinks.Grafana.Loki.LokiJsonTextFormatter, Serilog.Sinks.Grafana.Loki"
161+
"textFormatter": "My.Awesome.Namespace.MyTextFormatter, MyCoolAssembly"
156162
}
157163
}
158164
]

src/Serilog.Sinks.Grafana.Loki/ILabelAwareTextFormatter.cs

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/Serilog.Sinks.Grafana.Loki/LoggerConfigurationLokiExtensions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ namespace Serilog.Sinks.Grafana.Loki;
2626
/// </summary>
2727
public static class LoggerConfigurationLokiExtensions
2828
{
29-
private const string DefaultOutputTemplate =
30-
"[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}";
31-
3229
/// <summary>
3330
/// Adds a non-durable sink that will send log events to Grafana Loki.
3431
/// A non-durable sink will lose data after a system or process restart.

0 commit comments

Comments
 (0)