diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props
index 4375cafb6..48cea7846 100644
--- a/src/Directory.Packages.props
+++ b/src/Directory.Packages.props
@@ -30,6 +30,7 @@
+
@@ -60,4 +61,4 @@
-
\ No newline at end of file
+
diff --git a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs
index 9d7249379..81da4dbfd 100644
--- a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs
+++ b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs
@@ -44,6 +44,8 @@ public interface IConfigFileProvider : IHandleAsync,
bool UpdateAutomatically { get; }
UpdateMechanism UpdateMechanism { get; }
string UpdateScriptPath { get; }
+ string SyslogServer { get; }
+ int SyslogPort { get; }
}
public class ConfigFileProvider : IConfigFileProvider
@@ -209,6 +211,9 @@ public string UrlBase
public string UpdateScriptPath => GetValue("UpdateScriptPath", "", false);
+ public string SyslogServer => GetValue("SyslogServer", "", persist: false);
+ public int SyslogPort => GetValueInt("SyslogPort", 514, persist: false);
+
public int GetValueInt(string key, int defaultValue, bool persist = true)
{
return Convert.ToInt32(GetValue(key, defaultValue, persist));
diff --git a/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs b/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs
index 35421a90d..6e13f3811 100644
--- a/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs
+++ b/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs
@@ -2,6 +2,8 @@
using System.Linq;
using NLog;
using NLog.Config;
+using NLog.Targets.Syslog;
+using NLog.Targets.Syslog.Settings;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Instrumentation;
@@ -40,6 +42,11 @@ public void Reconfigure()
minimumConsoleLogLevel = LogLevel.Info;
}
+ if (_configFileProvider.SyslogServer.IsNotNullOrWhiteSpace())
+ {
+ SetSyslogParameters(_configFileProvider.SyslogServer, _configFileProvider.SyslogPort, minimumLogLevel);
+ }
+
var rules = LogManager.Configuration.LoggingRules;
//Console
@@ -101,6 +108,24 @@ private void ReconfigureSentry()
}
}
+ private void SetSyslogParameters(string syslogServer, int syslogPort, LogLevel minimumLogLevel)
+ {
+ var syslogTarget = new SyslogTarget();
+
+ syslogTarget.Name = "syslogTarget";
+ syslogTarget.MessageSend.Protocol = ProtocolType.Udp;
+ syslogTarget.MessageSend.Udp.Port = syslogPort;
+ syslogTarget.MessageSend.Udp.Server = syslogServer;
+ syslogTarget.MessageSend.Udp.ReconnectInterval = 500;
+ syslogTarget.MessageCreation.Rfc = RfcNumber.Rfc5424;
+ syslogTarget.MessageCreation.Rfc5424.AppName = BuildInfo.AppName;
+
+ var loggingRule = new LoggingRule("*", minimumLogLevel, syslogTarget);
+
+ LogManager.Configuration.AddTarget("syslogTarget", syslogTarget);
+ LogManager.Configuration.LoggingRules.Add(loggingRule);
+ }
+
private List GetLogLevels()
{
return new List
diff --git a/src/NzbDrone.Core/Readarr.Core.csproj b/src/NzbDrone.Core/Readarr.Core.csproj
index 309b2d63d..000ba70a7 100644
--- a/src/NzbDrone.Core/Readarr.Core.csproj
+++ b/src/NzbDrone.Core/Readarr.Core.csproj
@@ -18,6 +18,7 @@
+