File tree Expand file tree Collapse file tree 6 files changed +46
-2
lines changed Expand file tree Collapse file tree 6 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ nuget Microsoft.Extensions.Logging.Abstractions
1616nuget Microsoft.Extensions.Logging.Configuration
1717nuget Microsoft.Extensions.Logging.Console
1818nuget Microsoft.Extensions.Options.ConfigurationExtensions
19+ nuget Gelf.Extensions.Logging
1920nuget morelinq
2021nuget NuGet.Client
2122nuget NuGet.Packaging
Original file line number Diff line number Diff line change 1414 System.ComponentModel.Annotations (>= 4.4.1)
1515 System.ComponentModel.Primitives (>= 4.3)
1616 System.ValueTuple (>= 4.5)
17+ Gelf.Extensions.Logging (1.4)
18+ Microsoft.Extensions.Logging (>= 2.0)
19+ Newtonsoft.Json (>= 10.0.3)
20+ System.Threading.Tasks.Dataflow (>= 4.8)
21+ System.ValueTuple (>= 4.4)
1722 McMaster.Extensions.CommandLineUtils (2.2.5)
1823 System.ComponentModel.Annotations (>= 4.4.1)
1924 Microsoft.AspNet.WebApi.Client (5.2.6) - restriction: || (== netcoreapp2.1) (&& (== netstandard2.0) (>= netcoreapp2.1))
@@ -1529,6 +1534,7 @@ NUGET
15291534 Microsoft.NETCore.Platforms (>= 1.1)
15301535 Microsoft.NETCore.Targets (>= 1.1)
15311536 System.Runtime (>= 4.3)
1537+ System.Threading.Tasks.Dataflow (4.9)
15321538 System.Threading.Tasks.Extensions (4.5.1)
15331539 System.Threading.Tasks.Parallel (4.3) - restriction: || (== netcoreapp2.1) (&& (== netstandard2.0) (>= netcoreapp2.1))
15341540 System.Collections.Concurrent (>= 4.3)
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ About this fork:
1212 - implements read-through cache, which [ does not work upstream] ( https://github.com/loic-sharma/BaGet/issues/93 )
1313 - uses paket and FAKE for build system. [ PR] ( https://github.com/loic-sharma/BaGet/pull/108 )
1414 - uses [ Carter] ( https://github.com/CarterCommunity/Carter ) for routing rather than bare Asp routing.
15+ - adds ability to log to graylog
1516 - we intend to merge all this upstream, but review is slow and we need working server now.
1617 - we intend to move V2 from LiGet to BaGet.
1718
@@ -31,6 +32,17 @@ For persistent data, you should mount **volumes**:
3132You should change the default api key (` NUGET-SERVER-API-KEY ` ) used for pushing packages,
3233by setting SHA256 into ` ApiKeyHash ` environment variable.
3334
35+ ### Logging to graylog
36+
37+ BaGet is using [ GELF provider for Microsoft.Extensions.Logging] ( https://github.com/mattwcole/gelf-extensions-logging )
38+ to optionally configure logging via GELF to graylog.
39+ To configure docker image for logging to your graylog, you can set following environment variables:
40+ ```
41+ Graylog__Host=your-graylog.com
42+ Graylog__Port=12201
43+ Graylog__AdditionalFields__environment=development
44+ ```
45+
3446## On client side
3547
3648### Usage only as private repository
Original file line number Diff line number Diff line change 11using BaGet . Core . Mirror ;
22using BaGet . Extensions ;
3+ using Gelf . Extensions . Logging ;
34using McMaster . Extensions . CommandLineUtils ;
45using Microsoft . AspNetCore ;
56using Microsoft . AspNetCore . Hosting ;
67using Microsoft . Extensions . DependencyInjection ;
78using Microsoft . Extensions . Hosting ;
9+ using Microsoft . Extensions . Logging ;
810
911namespace BaGet
1012{
@@ -46,6 +48,17 @@ await provider
4648 public static IWebHostBuilder CreateWebHostBuilder ( string [ ] args ) =>
4749 WebHost . CreateDefaultBuilder ( args )
4850 . UseStartup < Startup > ( )
51+ . ConfigureLogging ( ( context , builder ) =>
52+ {
53+ // Read GelfLoggerOptions from appsettings.json
54+ builder . Services . Configure < GelfLoggerOptions > ( context . Configuration . GetSection ( "Graylog" ) ) ;
55+
56+ // Read Logging settings from appsettings.json and add providers.
57+ builder . AddConfiguration ( context . Configuration . GetSection ( "Logging" ) )
58+ . AddConsole ( )
59+ . AddDebug ( )
60+ . AddGelf ( ) ;
61+ } )
4962 . UseUrls ( "http://0.0.0.0:9090" )
5063 . UseKestrel ( options =>
5164 {
Original file line number Diff line number Diff line change 3333 "LogLevel" : {
3434 "Default" : " Warning"
3535 }
36+ },
37+ "GELF" : {
38+ "IncludeScopes" : true ,
39+ "LogLevel" : {
40+ "Default" : " Information"
41+ }
3642 }
43+ },
44+ "Graylog" : {
45+ "Host" : " localhost" ,
46+ "Port" : 12201 ,
47+ "LogSource" : " baget"
3748 }
38- }
49+ }
Original file line number Diff line number Diff line change @@ -4,4 +4,5 @@ Microsoft.Data.SQLite
44Microsoft.EntityFrameworkCore.Sqlite
55Microsoft.Extensions.Logging.Configuration
66Microsoft.Extensions.Logging.Console
7- NuGet.Client
7+ Gelf.Extensions.Logging
8+ NuGet.Client
You can’t perform that action at this time.
0 commit comments