feat(bot): add opensearch log configuration

This commit is contained in:
alyssa 2024-11-21 06:50:55 +09:00
parent 83d1a08aaf
commit f3e006034b
6 changed files with 157 additions and 35 deletions

View file

@ -131,6 +131,15 @@
"App.Metrics.Formatters.InfluxDB": "4.1.0"
}
},
"AppFact.SerilogOpenSearchSink": {
"type": "Transitive",
"resolved": "0.0.8",
"contentHash": "RI3lfmvAwhqrYwy5KPqsBT/tB/opSzeoVH2WUfvGKNBpl6ILCw/5wE8+19L+XMzBFVqgZ5QmkQ2PqTzG9I/ckA==",
"dependencies": {
"OpenSearch.Client": "1.4.0",
"Serilog": "2.12.0"
}
},
"Autofac": {
"type": "Transitive",
"resolved": "6.0.0",
@ -514,6 +523,24 @@
"Npgsql": "4.1.5"
}
},
"OpenSearch.Client": {
"type": "Transitive",
"resolved": "1.4.0",
"contentHash": "91TXm+I8PzxT0yxkf0q5Quee5stVcIFys56pU8+M3+Kiakx+aiaTAlZJHfA3Oy6dMJndNkVm37IPKYCqN3dS4g==",
"dependencies": {
"OpenSearch.Net": "1.4.0"
}
},
"OpenSearch.Net": {
"type": "Transitive",
"resolved": "1.4.0",
"contentHash": "xCM6m3aArN9gXIl2DvWXaDlbpjOBbgMeRPsAM7s1eDbWhu8wKNyfPNKSfep4JlYXkZ7N6Oi/+lmi+G3/SpcqlQ==",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"System.Buffers": "4.5.1",
"System.Diagnostics.DiagnosticSource": "6.0.1"
}
},
"Pipelines.Sockets.Unofficial": {
"type": "Transitive",
"resolved": "2.2.8",
@ -797,8 +824,8 @@
},
"System.Buffers": {
"type": "Transitive",
"resolved": "4.5.0",
"contentHash": "pL2ChpaRRWI/p4LXyy4RgeWlYF2sgfj/pnVMvBqwNFr5cXg7CXNnWZWxrOONLg8VGdFB8oB+EG2Qw4MLgTOe+A=="
"resolved": "4.5.1",
"contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
"System.Collections": {
"type": "Transitive",
@ -851,8 +878,11 @@
},
"System.Diagnostics.DiagnosticSource": {
"type": "Transitive",
"resolved": "4.7.1",
"contentHash": "j81Lovt90PDAq8kLpaJfJKV/rWdWuEk6jfV+MBkee33vzYLEUsy4gXK8laa9V2nZlLM9VM9yA/OOQxxPEJKAMw=="
"resolved": "6.0.1",
"contentHash": "KiLYDu2k2J82Q9BJpWiuQqCkFjRBWVq4jDzKKWawVi9KWzyD0XG3cmfX0vqTQlL14Wi9EufJrbL0+KCLTbqWiQ==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Diagnostics.Tools": {
"type": "Transitive",
@ -1216,8 +1246,8 @@
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
"resolved": "4.7.1",
"contentHash": "zOHkQmzPCn5zm/BH+cxC1XbUS3P4Yoi3xzW7eRgVpDR2tPGSzyMZ17Ig1iRkfJuY0nhxkQQde8pgePNiA7z7TQ=="
"resolved": "6.0.0",
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
},
"System.Runtime.Extensions": {
"type": "Transitive",
@ -1540,6 +1570,7 @@
"dependencies": {
"App.Metrics": "[4.1.0, )",
"App.Metrics.Reporting.InfluxDB": "[4.1.0, )",
"AppFact.SerilogOpenSearchSink": "[0.0.8, )",
"Autofac": "[6.0.0, )",
"Autofac.Extensions.DependencyInjection": "[7.1.0, )",
"Dapper": "[2.0.35, )",

View file

@ -116,6 +116,15 @@
"App.Metrics.Formatters.InfluxDB": "4.1.0"
}
},
"AppFact.SerilogOpenSearchSink": {
"type": "Transitive",
"resolved": "0.0.8",
"contentHash": "RI3lfmvAwhqrYwy5KPqsBT/tB/opSzeoVH2WUfvGKNBpl6ILCw/5wE8+19L+XMzBFVqgZ5QmkQ2PqTzG9I/ckA==",
"dependencies": {
"OpenSearch.Client": "1.4.0",
"Serilog": "2.12.0"
}
},
"Autofac": {
"type": "Transitive",
"resolved": "6.0.0",
@ -464,6 +473,24 @@
"Npgsql": "4.1.5"
}
},
"OpenSearch.Client": {
"type": "Transitive",
"resolved": "1.4.0",
"contentHash": "91TXm+I8PzxT0yxkf0q5Quee5stVcIFys56pU8+M3+Kiakx+aiaTAlZJHfA3Oy6dMJndNkVm37IPKYCqN3dS4g==",
"dependencies": {
"OpenSearch.Net": "1.4.0"
}
},
"OpenSearch.Net": {
"type": "Transitive",
"resolved": "1.4.0",
"contentHash": "xCM6m3aArN9gXIl2DvWXaDlbpjOBbgMeRPsAM7s1eDbWhu8wKNyfPNKSfep4JlYXkZ7N6Oi/+lmi+G3/SpcqlQ==",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"System.Buffers": "4.5.1",
"System.Diagnostics.DiagnosticSource": "6.0.1"
}
},
"Pipelines.Sockets.Unofficial": {
"type": "Transitive",
"resolved": "2.2.8",
@ -726,8 +753,8 @@
},
"System.Buffers": {
"type": "Transitive",
"resolved": "4.5.0",
"contentHash": "pL2ChpaRRWI/p4LXyy4RgeWlYF2sgfj/pnVMvBqwNFr5cXg7CXNnWZWxrOONLg8VGdFB8oB+EG2Qw4MLgTOe+A=="
"resolved": "4.5.1",
"contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
"System.Collections": {
"type": "Transitive",
@ -780,8 +807,11 @@
},
"System.Diagnostics.DiagnosticSource": {
"type": "Transitive",
"resolved": "4.7.1",
"contentHash": "j81Lovt90PDAq8kLpaJfJKV/rWdWuEk6jfV+MBkee33vzYLEUsy4gXK8laa9V2nZlLM9VM9yA/OOQxxPEJKAMw=="
"resolved": "6.0.1",
"contentHash": "KiLYDu2k2J82Q9BJpWiuQqCkFjRBWVq4jDzKKWawVi9KWzyD0XG3cmfX0vqTQlL14Wi9EufJrbL0+KCLTbqWiQ==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Diagnostics.Tools": {
"type": "Transitive",
@ -1123,8 +1153,8 @@
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
"resolved": "4.7.1",
"contentHash": "zOHkQmzPCn5zm/BH+cxC1XbUS3P4Yoi3xzW7eRgVpDR2tPGSzyMZ17Ig1iRkfJuY0nhxkQQde8pgePNiA7z7TQ=="
"resolved": "6.0.0",
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
},
"System.Runtime.Extensions": {
"type": "Transitive",
@ -1459,6 +1489,7 @@
"dependencies": {
"App.Metrics": "[4.1.0, )",
"App.Metrics.Reporting.InfluxDB": "[4.1.0, )",
"AppFact.SerilogOpenSearchSink": "[0.0.8, )",
"Autofac": "[6.0.0, )",
"Autofac.Extensions.DependencyInjection": "[7.1.0, )",
"Dapper": "[2.0.35, )",

View file

@ -2,6 +2,8 @@ using System.Globalization;
using Autofac;
using AppFact.SerilogOpenSearchSink;
using Microsoft.Extensions.Logging;
using NodaTime;
@ -9,7 +11,6 @@ using NodaTime;
using Serilog;
using Serilog.Events;
using Serilog.Formatting.Compact;
using Serilog.Sinks.Elasticsearch;
using Serilog.Sinks.Seq;
using Serilog.Sinks.SystemConsole.Themes;
@ -104,16 +105,12 @@ public class LoggingModule: Module
if (config.ElasticUrl != null)
{
var elasticConfig = new ElasticsearchSinkOptions(new Uri(config.ElasticUrl))
{
AutoRegisterTemplate = true,
AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv7,
MinimumLogEventLevel = config.ElasticLogLevel,
IndexFormat = "pluralkit-logs-{0:yyyy.MM.dd}",
CustomFormatter = new ScalarFormatting.Elasticsearch()
};
logCfg.WriteTo.Elasticsearch(elasticConfig);
logCfg.WriteTo.OpenSearch(
uri: config.ElasticUrl,
index: "dotnet-logs",
basicAuthUser: "unused",
basicAuthPassword: "unused"
);
}
if (config.SeqLogUrl != null)

View file

@ -18,6 +18,7 @@
<ItemGroup>
<PackageReference Include="App.Metrics" Version="4.1.0" />
<PackageReference Include="App.Metrics.Reporting.InfluxDB" Version="4.1.0" />
<PackageReference Include="AppFact.SerilogOpenSearchSink" Version="0.0.8" />
<PackageReference Include="Autofac" Version="6.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
<PackageReference Include="Dapper" Version="2.0.35" />

View file

@ -22,6 +22,16 @@
"App.Metrics.Formatters.InfluxDB": "4.1.0"
}
},
"AppFact.SerilogOpenSearchSink": {
"type": "Direct",
"requested": "[0.0.8, )",
"resolved": "0.0.8",
"contentHash": "RI3lfmvAwhqrYwy5KPqsBT/tB/opSzeoVH2WUfvGKNBpl6ILCw/5wE8+19L+XMzBFVqgZ5QmkQ2PqTzG9I/ckA==",
"dependencies": {
"OpenSearch.Client": "1.4.0",
"Serilog": "2.12.0"
}
},
"Autofac": {
"type": "Direct",
"requested": "[6.0.0, )",
@ -551,6 +561,24 @@
"System.Xml.XDocument": "4.3.0"
}
},
"OpenSearch.Client": {
"type": "Transitive",
"resolved": "1.4.0",
"contentHash": "91TXm+I8PzxT0yxkf0q5Quee5stVcIFys56pU8+M3+Kiakx+aiaTAlZJHfA3Oy6dMJndNkVm37IPKYCqN3dS4g==",
"dependencies": {
"OpenSearch.Net": "1.4.0"
}
},
"OpenSearch.Net": {
"type": "Transitive",
"resolved": "1.4.0",
"contentHash": "xCM6m3aArN9gXIl2DvWXaDlbpjOBbgMeRPsAM7s1eDbWhu8wKNyfPNKSfep4JlYXkZ7N6Oi/+lmi+G3/SpcqlQ==",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"System.Buffers": "4.5.1",
"System.Diagnostics.DiagnosticSource": "6.0.1"
}
},
"Pipelines.Sockets.Unofficial": {
"type": "Transitive",
"resolved": "2.2.8",
@ -692,8 +720,8 @@
},
"System.Buffers": {
"type": "Transitive",
"resolved": "4.5.0",
"contentHash": "pL2ChpaRRWI/p4LXyy4RgeWlYF2sgfj/pnVMvBqwNFr5cXg7CXNnWZWxrOONLg8VGdFB8oB+EG2Qw4MLgTOe+A=="
"resolved": "4.5.1",
"contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
"System.Collections": {
"type": "Transitive",
@ -746,8 +774,11 @@
},
"System.Diagnostics.DiagnosticSource": {
"type": "Transitive",
"resolved": "4.7.1",
"contentHash": "j81Lovt90PDAq8kLpaJfJKV/rWdWuEk6jfV+MBkee33vzYLEUsy4gXK8laa9V2nZlLM9VM9yA/OOQxxPEJKAMw=="
"resolved": "6.0.1",
"contentHash": "KiLYDu2k2J82Q9BJpWiuQqCkFjRBWVq4jDzKKWawVi9KWzyD0XG3cmfX0vqTQlL14Wi9EufJrbL0+KCLTbqWiQ==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Diagnostics.Tools": {
"type": "Transitive",
@ -1081,8 +1112,8 @@
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
"resolved": "4.7.1",
"contentHash": "zOHkQmzPCn5zm/BH+cxC1XbUS3P4Yoi3xzW7eRgVpDR2tPGSzyMZ17Ig1iRkfJuY0nhxkQQde8pgePNiA7z7TQ=="
"resolved": "6.0.0",
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
},
"System.Runtime.Extensions": {
"type": "Transitive",

View file

@ -108,6 +108,15 @@
"App.Metrics.Formatters.InfluxDB": "4.1.0"
}
},
"AppFact.SerilogOpenSearchSink": {
"type": "Transitive",
"resolved": "0.0.8",
"contentHash": "RI3lfmvAwhqrYwy5KPqsBT/tB/opSzeoVH2WUfvGKNBpl6ILCw/5wE8+19L+XMzBFVqgZ5QmkQ2PqTzG9I/ckA==",
"dependencies": {
"OpenSearch.Client": "1.4.0",
"Serilog": "2.12.0"
}
},
"Autofac": {
"type": "Transitive",
"resolved": "6.0.0",
@ -595,6 +604,24 @@
"resolved": "5.0.0",
"contentHash": "c5JVjuVAm4f7E9Vj+v09Z9s2ZsqFDjBpcsyS3M9xRo0bEdm/LVZSzLxxNvfvAwRiiE8nwe1h2G4OwiwlzFKXlA=="
},
"OpenSearch.Client": {
"type": "Transitive",
"resolved": "1.4.0",
"contentHash": "91TXm+I8PzxT0yxkf0q5Quee5stVcIFys56pU8+M3+Kiakx+aiaTAlZJHfA3Oy6dMJndNkVm37IPKYCqN3dS4g==",
"dependencies": {
"OpenSearch.Net": "1.4.0"
}
},
"OpenSearch.Net": {
"type": "Transitive",
"resolved": "1.4.0",
"contentHash": "xCM6m3aArN9gXIl2DvWXaDlbpjOBbgMeRPsAM7s1eDbWhu8wKNyfPNKSfep4JlYXkZ7N6Oi/+lmi+G3/SpcqlQ==",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"System.Buffers": "4.5.1",
"System.Diagnostics.DiagnosticSource": "6.0.1"
}
},
"Pipelines.Sockets.Unofficial": {
"type": "Transitive",
"resolved": "2.2.8",
@ -914,8 +941,8 @@
},
"System.Buffers": {
"type": "Transitive",
"resolved": "4.5.0",
"contentHash": "pL2ChpaRRWI/p4LXyy4RgeWlYF2sgfj/pnVMvBqwNFr5cXg7CXNnWZWxrOONLg8VGdFB8oB+EG2Qw4MLgTOe+A=="
"resolved": "4.5.1",
"contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
"System.Collections": {
"type": "Transitive",
@ -968,8 +995,11 @@
},
"System.Diagnostics.DiagnosticSource": {
"type": "Transitive",
"resolved": "4.7.1",
"contentHash": "j81Lovt90PDAq8kLpaJfJKV/rWdWuEk6jfV+MBkee33vzYLEUsy4gXK8laa9V2nZlLM9VM9yA/OOQxxPEJKAMw=="
"resolved": "6.0.1",
"contentHash": "KiLYDu2k2J82Q9BJpWiuQqCkFjRBWVq4jDzKKWawVi9KWzyD0XG3cmfX0vqTQlL14Wi9EufJrbL0+KCLTbqWiQ==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Diagnostics.Tools": {
"type": "Transitive",
@ -1333,8 +1363,8 @@
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
"resolved": "4.7.1",
"contentHash": "zOHkQmzPCn5zm/BH+cxC1XbUS3P4Yoi3xzW7eRgVpDR2tPGSzyMZ17Ig1iRkfJuY0nhxkQQde8pgePNiA7z7TQ=="
"resolved": "6.0.0",
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
},
"System.Runtime.Extensions": {
"type": "Transitive",
@ -1737,6 +1767,7 @@
"dependencies": {
"App.Metrics": "[4.1.0, )",
"App.Metrics.Reporting.InfluxDB": "[4.1.0, )",
"AppFact.SerilogOpenSearchSink": "[0.0.8, )",
"Autofac": "[6.0.0, )",
"Autofac.Extensions.DependencyInjection": "[7.1.0, )",
"Dapper": "[2.0.35, )",