diff --git a/src/NzbDrone.Common/Radarr.Common.csproj b/src/NzbDrone.Common/Radarr.Common.csproj
index cf01c2dd7..27c219371 100644
--- a/src/NzbDrone.Common/Radarr.Common.csproj
+++ b/src/NzbDrone.Common/Radarr.Common.csproj
@@ -11,6 +11,7 @@
+
diff --git a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs
index 46e2f396c..d0253aaed 100644
--- a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs
+++ b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs
@@ -46,6 +46,8 @@ public interface IConfigFileProvider : IHandleAsync,
bool UpdateAutomatically { get; }
UpdateMechanism UpdateMechanism { get; }
string UpdateScriptPath { get; }
+ string SyslogServer { get; }
+ int SyslogPort { get; }
}
public class ConfigFileProvider : IConfigFileProvider
@@ -211,6 +213,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 36025d64e..f6c3af5b2 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