File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using Microsoft . AspNetCore . HttpLogging ;
2+ using Microsoft . AspNetCore . HttpOverrides ;
23using Serilog ;
34using Serilog . Core ;
45using Serilog . Exceptions ;
@@ -75,7 +76,15 @@ private static async Task Main(string[] args)
7576
7677 var app = builder . Build ( ) ;
7778
78- _ = app . UseForwardedHeaders ( ) ;
79+ var forwardOptions = new ForwardedHeadersOptions
80+ {
81+ ForwardedHeaders = ForwardedHeaders . All ,
82+ ForwardLimit = null
83+ } ;
84+ //forwardOptions.KnownProxies.Add(new IPAddress(0L));
85+ //forwardOptions.KnownNetworks.Add(new Microsoft.AspNetCore.HttpOverrides.IPNetwork(new IPAddress(0L), 0));
86+
87+ _ = app . UseForwardedHeaders ( forwardOptions ) ;
7988 _ = app . UseHttpsRedirection ( ) ;
8089
8190 _ = app . UseStaticFiles ( ) ;
Original file line number Diff line number Diff line change 2323 <PackageReference Include =" Serilog.Sinks.Async" Version =" 2.1.0" />
2424 <PackageReference Include =" Microsoft.Extensions.Logging.Abstractions" Version =" 9.0.4" />
2525 <PackageReference Include =" Serilog.Sinks.Grafana.Loki" Version =" 8.3.0" />
26+ <PackageReference Include =" Serilog.Sinks.Loki.YetAnother" Version =" 3.0.7" />
2627 </ItemGroup >
2728
2829 <ItemGroup >
Original file line number Diff line number Diff line change 5757 ]
5858 }
5959 },
60+ //{
61+ // "Name": "GrafanaLoki",
62+ // "Args": {
63+ // "uri": "http://localhost:3100",
64+ // "period": "00:00:05",
65+ // "labels": [
66+ // {
67+ // "key": "service_name",
68+ // "value": "SerilogTest"
69+ // }
70+ // ],
71+ // "propertiesAsLabels": [
72+ // "EnvironmentName"
73+ // ]
74+ // }
75+ // },
6076 {
61- "Name" : " GrafanaLoki " ,
77+ "Name" : " Loki " ,
6278 "Args" : {
63- "uri" : " http://localhost:3100" ,
79+ "configurations" : {
80+ "Url" : " http://localhost:3100" ,
81+ //"Credentials": {
82+ // "Password": "password",
83+ // "Username": "username"
84+ // },
85+ "Labels" : [
86+ {
87+ "key" : " service_name" ,
88+ "value" : " SerilogTest"
89+ }
90+ ],
91+ "PropertiesAsLabels" : [
92+ " EnvironmentName"
93+ ],
94+ "EnrichTraceId" : true ,
95+ "EnrichSpanId" : true
96+ },
6497 "period" : " 00:00:05" ,
65- "labels" : [
66- {
67- "key" : " service_name" ,
68- "value" : " SerilogTest"
69- }
70- ],
71- "propertiesAsLabels" : [
72- " EnvironmentName"
73- ]
98+ "retryTimeLimit" : " 00:10:00"
7499 }
75100 }
76101 ]
You can’t perform that action at this time.
0 commit comments