logdna / logdna-agent

LogDNA Agent streams from log files to your LogDNA account. Works with Linux, Windows, and macOS Servers
https://logdna.com
MIT License
138 stars 55 forks source link

Tag & hostname not working for AWS Elastic Beanstalk #64

Closed Jolg42 closed 5 years ago

Jolg42 commented 5 years ago

Hi,

I tried to add tags and change the hostname on AWS Elastic Beanstalk. In the logs I found Hostname: FSDEV saved to config. Tags: FSDEV has been saved to config.

It looks like it worked but I don't see anything on the dashboard, does it take a long time to appear maybe?

Here is my config file:

files:
  "/home/ec2-user/logdna.sh" :
    mode: "000777"
    owner: root
    group: root
    content: |
      #!/bin/sh
      echo "[logdna]
      name=LogDNA packages
      baseurl=http://repo.logdna.com/el6/
      enabled=1
      gpgcheck=0" | tee /etc/yum.repos.d/logdna.repo
      yum -y install logdna-agent
      logdna-agent -k MYKEY # this is your unique Ingestion Key
      logdna-agent --hostname FSDEV
      logdna-agent -t FSDEV
      # /var/log is monitored/added by default (recursively), optionally add more dirs here
      logdna-agent -d /var/app/current/logs
      chkconfig logdna-agent on
      service logdna-agent start
commands:
  logdna:
    command: "/home/ec2-user/logdna.sh"
gtlpanda commented 5 years ago

@Jolg42

I'll make sure to test your config today and close out this issue.

Best,

Carlos

gtlpanda commented 5 years ago

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 (remove # to uncomment the line below)

logdna-agent --hostname {"Ref": "AWSEBEnvironmentName" }

-t option allows you to tag the host with tags (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"

smusali commented 5 years ago

@Jolg42,

As I got informed, all is working well now; so, closing this issue!

Happy Logging!

Jolg42 commented 5 years ago

Posting a working example as a reference:

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
      # logdna-agent -d /var/app/current/logs
      # --hostname allows you to pass your env hostname/appname to LogDNA
      logdna-agent --hostname `{"Ref": "AWSEBEnvironmentName" }`
      # -t option allows you to tag the host with tags
      logdna-agent -t CUSTOMTAG
      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"
smusali commented 5 years ago

Thanks, @Jolg42!