title: How to send log to Cloud Watch in C# application
body: <p>I want to be able to send application logs to <code>Cloud Watch Log</code>. and I got to know that there is a <code>Cloud Watch Agent</code> service that runs in the background and reads logs from log file and send only the delta (extra logs) to <code>Cloud Watch Log</code>. All this makes sense to me. Then I got to know about NLog a C# logging framework, and wrote below POC to send logs.</p>
  
  <pre><code>static void Main(string[] args)
  {
      ConfigureNLog();
      var logger = NLog.LogManager.GetCurrentClassLogger();
      logger.Info("Hello World");
      logger.Log(LogLevel.Info, "Sample informational message");
  }
  static void ConfigureNLog()
  {
          var accessKey = ConfigurationManager.AppSettings.Get("AWSAccessKey");
          var secretKey = ConfigurationManager.AppSettings.Get("AWSSecretKey");
          var config = new LoggingConfiguration();
          var awsTarget = new AWSTarget()
          {
              LogGroup = "NLog.ProgrammaticConfigurationExample",
              Region = "us-east-1",
              Credentials = new BasicAWSCredentials(accessKey, secretKey)
          };
          config.AddTarget("aws", awsTarget);
          config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, awsTarget));
  
          LogManager.Configuration = config;
  }
  </code></pre>
  
  <p>Now when I run above code, I am able to send log to Cloud Watch. But I am confused now, where is the significance of Cloud Watch Agent? </p>
  
  <ol>
  <li><p>Since I am directly sending log data, does that mean I don't need Cloud Watch Agent in my scenario?</p></li>
  <li><p>In case I want to use <code>Cloud Watch Agent</code> then I need to use <code>FILE</code> as a target for logs by <code>NLog</code> and then tell Cloud Watch Agent to send that log file to Cloud Watch Log??</p></li>
  </ol>
  
  <p>Is my understanding correct? Please help me in understanding the flow.</p>
  
  <p>Is below flow correct?</p>
  
  <blockquote>
    <p>NLog write log to File -> Cloud Agent read log from there -> Send log
    to Cloud Watch</p>
  </blockquote>
  
  <p><strong>Question:</strong> How to use Cloud Watch Agent in above POC to send data via NLog?</p>