Elastic Beanstalk Logs

Learn how to get setup to start collecting, monitoring, and analyzing your elb logs for easy, centralized log management.

For the best user experience, we recommend logging into the LogDNA web app and following the account-tailored add log source instructions. You may also follow the more generic instructions below

Copy the configuration below into a .conf file in your Elastic Beanstalk app's .ebextensions directory.

files:
  "/home/ec2-user/logdna.sh" :
    mode: "000777"
    owner: root
    group: root
    content: |
      #!/bin/sh
      rpm --import https://repo.logdna.com/logdna.gpg
      echo "[logdna]
      name=LogDNA packages
      baseurl=https://repo.logdna.com/el6/
      enabled=1
      gpgcheck=1
      gpgkey=https://repo.logdna.com/logdna.gpg" | sudo tee /etc/yum.repos.d/logdna.repo
      yum -y install logdna-agent
      logdna-agent -k INSERT_KEY_HERE # this is your unique Ingestion Key
      # /var/log is monitored/added by default (recursively), optionally add more dirs here (remove # to uncomment the line)
      #logdna-agent -d /path/to/your/logs
      # --hostname allows you to pass your env hostname/appname to LogDNA, optionally you can change this to whatever you want (remove # to uncomment the line below)
      #logdna-agent --hostname `{"Ref": "AWSEBEnvironmentName" }`
      # -t option allows you to tag the host/app with the existing host/app name, optionally you can change this to whatever you want (remove # to uncomment the line below)
      #logdna-agent -t `{"Ref": "AWSEBEnvironmentName" }`
      chkconfig logdna-agent on
      service logdna-agent start
commands:
  01_install_logdna:
    command: "/home/ec2-user/logdna.sh"
  02_restart_logdna:
    command: "service logdna-agent restart"

Before redeploying your Elastic Beanstalk app, be sure to insert your LogDNA Ingestion Key and specify any custom directories you want the LogDNA agent to monitor.