-
Hi, I'm running the following configuration: {
"Serilog": {
"Using": [
"Serilog.Sinks.Grafana.Loki"
],
"WriteTo": [
{
"Name": "GrafanaLoki",
"Args": {
"uri": "http://localhost:3100",
"outputTemplate": "{Timestamp:dd-MM-yyyy HH:mm:ss} [{Level:u3}] [{ThreadId}] {Message}{NewLine}{Exception}",
"restrictedToMinimumLevel": "Debug",
"filtrationMode": "Include",
"filtrationLabels": [
"Application"
],
"textFormatter": "Serilog.Sinks.Grafana.Loki.LokiJsonTextFormatter, Serilog.Sinks.Grafana.Loki"
}
}
],
"Enrich": [
"FromLogContext",
"WithEnvironmentName",
"WithExceptionDetails"
],
"Destructure": [
{
"Name": "ToMaximumDepth",
"Args": {
"maximumDestructuringDepth": 5
}
},
{
"Name": "ToMaximumStringLength",
"Args": {
"maximumStringLength": 8192
}
},
{
"Name": "ToMaximumCollectionCount",
"Args": {
"maximumCollectionCount": 16
}
}
],
"MinimumLevel": {
"Default": "Debug"
}
},
"Properties": {
"Application": "MyService"
}
} This results in Then when I'm adding the following args to the Loki section: {
"Name": "GrafanaLoki",
"Args": {
// ...
"labels": [
{
"key": "Application",
"value": "MyService"
}
],
// ...
} it does work. However according to https://github.com/serilog/serilog-settings-configuration the The same issue occurs when using the enviroment enricher https://github.com/serilog/serilog-enrichers-environment. {
"Name": "GrafanaLoki",
"Args": {
// ...
"filtrationLabels": [
"EnvironmentName",
"Application"
],
// ...
}
} The I've been pushing them to an internal endpoint to see what happens: public class LokiController : ControllerBase
{
[HttpPost("loki/api/v1/push")]
[AllowAnonymous]
public IActionResult Do([FromBody] JObject body)
{
var json = JsonConvert.SerializeObject(body, new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
});
return BadRequest();
}
} Example output: {
"streams": [
{
"stream": {}, // Nothing there ???
"values": [
[
"1673988513748000000",
"{ ... }"
],
[
"1673988513819000000",
"{ ... }"
]
]
}
]
} My service:
Any thoughts? Cheers, Peter |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi @poostwoud, At the first sight, seems like you have a misconfiguration. Because |
Beta Was this translation helpful? Give feedback.
-
@mishamyte 🤦♂️ thanks I missed the fact |
Beta Was this translation helpful? Give feedback.
Hi @poostwoud,
At the first sight, seems like you have a misconfiguration. Because
filtrationMode
andfiltrationLabels
are deprecated in v8.I recommend to read #99 and recheck the configuration doc and samples