title: AWS Elastic Beanstalk default CloudWatch log location for Java applications
body: <p>I have deployed a JAR file in an AWS Elastic Beanstalk environment, using a load balancer and maximum 2 EC2 instances.</p>
  <p>My environment seems to be using <em>the new unified CloudWatch agent</em>, not the legacy CloudWatch Logs Agent</p>
  <p>In the environment configuration in the console I turned on &quot;Instance log streaming to CloudWatch Logs&quot;, and now in CloudWatch Logs I get the following groups:</p>
  <ul>
  <li><code>/aws/elasticbeanstalk/myapp-myenv/var/log/eb-engine.log</code></li>
  <li><code>/aws/elasticbeanstalk/myapp-myenv/var/log/eb-hooks.log</code></li>
  <li><code>/aws/elasticbeanstalk/myapp-myenv/var/log/nginx/access.log</code></li>
  <li><code>/aws/elasticbeanstalk/myapp-myenv/var/log/nginx/error.log</code></li>
  <li><code>/aws/elasticbeanstalk/myapp-myenv/var/log/web.stdout.log</code></li>
  </ul>
  <p>This is nice. Notably the web server accesses are in <code>access.log</code>, and even the STDOUT console output of my JAR file is in <code>web.stdout.log</code>. So far so good.</p>
  <p>Now let's say I want my JAR application to generate a log file and have it picked up automatically in CloudWatch Logs. I've read the <a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.logging.html" rel="nofollow noreferrer">Elastic Beanstalk EC2 logging documentation</a> which says that I can bundle special <code>.ebextensions</code> in my application to indicate new logging locations &quot;[i]f your application generates logs in a location that isn't part of the default configuration for your environment's platform&quot;.</p>
  <p>In the short term I'd rather not create an <code>.ebextensions</code> file. The part about &quot;… a location … part of the default configuration …&quot; intrigues me.</p>
  <p><strong>Is there a default location for the Elastic Beanstalk Java platform logs?</strong> In other words, is there some default location such as <code>/var/log/app/</code> that I can simply have my application log to (e.g. via environment variable configuration) and have CloudWatch Logs with the new unified agent automatically pick them up, without needing to create an <code>.ebextensions</code> file? (As a second best solution, is there a way I can configure the location using the AWS console?)</p>