0

What's the best way to send logs from Auto scaling groups (of EC2) to Logentries.

I previously used the EC2 platform to create EC2 log monitoring for all of my EC2 instances created by an Autoscaling group. However according to Autoscaling rules, new instance will spin up if a current one is destroyed.

Now how do I create an automation for Logentries to create a new hosts and starting getting logs. I've read this https://logentries.com/doc/linux-agent-with-chef/#updating-le-agent I'm stuck at the override['le']['pull-server-side-config'] = false since I don't know anything about Chef (I just took the training from their site)

2
  • Why not use the Linux Agent - Autoscaling format?
    – James
    Sep 25, 2015 at 20:37
  • @James So where should I install this linux agent? Is it gonna be on my local linux machine or each of the EC2? I don't get how would the "agent" know if there is a new EC2 instance created on AWS?
    – Casper
    Sep 25, 2015 at 21:34

1 Answer 1

1

For an Autoscaling group, you need to get this baked into an AMI, or scripted to run on startup. You can get an EC2 instance to run commands on startup, after you've figured out which script to run.

The Logentries Linux Agent installation docs has setup instructions for an Amazon AMI (under Installation > Select your distro below > Amazon AMI).

Run the following commands one by one in your terminal:

You will need to provide your Logentries credentials to link the agent to your account.

sudo -s
tee /etc/yum.repos.d/logentries.repo <<EOF
[logentries]
name=Logentries repo
enabled=1
metadata_expire=1d
baseurl=http://rep.logentries.com/amazon\$releasever/\$basearch
gpgkey=http://rep.logentries.com/RPM-GPG-KEY-logentries
EOF
yum update
yum install logentries
le register
yum install logentries-daemon

I recommend trying that script once and seeing if it works properly for you, then you could include it in the user data for your Autoscaling launch configuration.

9
  • Thanks, but when and where does "Linux Agent - Autoscaling" come in?
    – Casper
    Sep 25, 2015 at 23:55
  • After you figure out how to configure the agent for one instance :)
    – James
    Sep 26, 2015 at 4:35
  • the link to baseurl from your script don't work, what are those anyway?
    – Casper
    Sep 28, 2015 at 22:08
  • It's the configuration for Logentries' Yum repo, so the yum install logentries command below will work.
    – James
    Sep 28, 2015 at 22:59
  • Now I just need to rewrite this script so it won't prompt for any input during installation... and also, do you happen to know if I can run a script before an instance terminates (I want to remove that host on Logentries when an instance is terminated)
    – Casper
    Sep 29, 2015 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.