title: How to log library logs to AWS CloudWatch using Serilog?
body: <p>Currently, I am working on ASP.NET 6 Web API and as a logger We use Serilog to log all the necessary details to cloudwatch and it's working fine. Now I need to add library logs such as AWS errors to cloudwatch. Currently there is an option for that in config file but it only saves logs as a file which results a <strong>No space left on device : '/app/Logs/serilog-aws-errors.txt'</strong> and the details in the file didn't appear on cloudwatch logs.</p>
  <p>This is the appsettings data I use,</p>
  <pre><code>&quot;Serilog&quot;: {
  &quot;Using&quot;: [ &quot;AWS.Logger.SeriLog&quot;, &quot;Serilog.Sinks.Console&quot;, &quot;Serilog.Sinks.File&quot; ],
  &quot;MinimumLevel&quot;: &quot;Debug&quot;,
  &quot;WriteTo&quot;: [
    { &quot;Name&quot;: &quot;AWSSeriLog&quot; },
    { &quot;Name&quot;: &quot;Console&quot; },
    {
      &quot;Name&quot;: &quot;File&quot;,
      &quot;Args&quot;: {
        &quot;path&quot;: &quot;Logs/webapi-.txt&quot;,
        &quot;rollingInterval&quot;: &quot;Day&quot;
      }
    }
  ],
  &quot;Region&quot;: &quot;eu-west-2&quot;,
  &quot;LogGroup&quot;: &quot;/development/serilog&quot;,
  &quot;LibraryLogFileName&quot;: &quot;Logs/serilog-aws-errors.txt&quot;
  }
  </code></pre>
  <p>I need to know that there is a way to log the details in serilog-aws-errors.txt to AWS cloudwatch or S3 bucket.</p>