title: Serilog ASP.NET Core appsettings config for syslog
body: <p>I am trying to configure Serilog using the appsettings.json config file in an ASP.NET Core web application. I have managed to get the RollingFile config section to work, but I am also trying to send log information to another online log tool (e.g. logentries or papertrail)</p>
  <p>I have the following Nuget packages installed:</p>
  <pre><code>Serilog.AspNetCore
  Serilog.Settings.Configuration
  Serilog.Sinks.Async
  Serilog.Sinks.RollingFile
  Serilog.Sinks.SyslogMessages
  </code></pre>
  <p>I have then put the following configuration in my appsettings.json file:</p>
  <pre><code>&quot;Serilog&quot;: {
    &quot;Using&quot;: [ &quot;Serilog.Sinks.Async&quot;, &quot;Serilog.Sinks.Syslog&quot;, &quot;Serilog.Sinks.RollingFile&quot; ],
    &quot;MinimumLevel&quot;: {
      &quot;Default&quot;: &quot;Information&quot;,
      &quot;Override&quot;: {
        &quot;Microsoft&quot;: &quot;Warning&quot;,
        &quot;System&quot;: &quot;Error&quot;
      }
    },
    &quot;WriteTo&quot;: [
      {
        &quot;Name&quot;: &quot;Async&quot;,
        &quot;Args&quot;: {
          &quot;configure&quot;: [
            {
              &quot;Name&quot;: &quot;RollingFile&quot;,
              &quot;Args&quot;: {
                &quot;outputTemplate&quot;: &quot;[{Timestamp:MMM dd HH:mm:ss}] {Level:u3} {Message:lj} &lt;s:{SourceContext}&gt;{NewLine}{Exception}&quot;,
                &quot;pathFormat&quot;: &quot;C:\\LogFiles\\Application\\{Date}.log&quot;,
                &quot;fileSizeLimitBytes&quot;: 5000000,
                &quot;retainedFileCountLimit&quot;: null
              }
            },
            {
              &quot;Name&quot;: &quot;Syslog&quot;,
              &quot;Args&quot;: {
                &quot;outputTemplate&quot;: &quot;[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} &lt;s:{SourceContext}&gt;{NewLine}{Exception}&quot;,
                &quot;host&quot;: &quot;logs.papertrailapp.com&quot;,
                &quot;port&quot;: 12345,
                &quot;format&quot;: &quot;RFC5424&quot;,
                &quot;secureProtocols&quot;: &quot;SecureProtocols.None&quot;,
                &quot;appName&quot;: &quot;Application&quot;,
                &quot;facility&quot;: &quot;Local7&quot;
              }
            }
          ]
        }
      }
    ]
  }
  </code></pre>
  <p>My C# code to set the logger is:</p>
  <pre><code>public static void Main(string[] args)
  {
      var currentEnv = Environment.GetEnvironmentVariable(&quot;ASPNETCORE_ENVIRONMENT&quot;);
      var configuration = new ConfigurationBuilder()
          .SetBasePath(Directory.GetCurrentDirectory())
          .AddJsonFile(&quot;appsettings.json&quot;)
          .AddJsonFile($&quot;appsettings.{currentEnv}.json&quot;, true)
          .AddEnvironmentVariables()
          .Build();
  
      Log.Logger =
          new LoggerConfiguration()
              .ReadFrom.Configuration(configuration)
              .CreateLogger();
  
      try
      {
          Log.Information(&quot;Starting web host&quot;);
          CreateWebHostBuilder(args).Build().Run();
      }
      catch (Exception exception)
      {
          Log.Fatal(exception, &quot;Host terminated unexpectedly&quot;);
          throw;
      }
      finally
      {
          Log.CloseAndFlush();
      }
  }
  </code></pre>
  <p>Am I missing something from the Syslog config block?</p>