Our docs are moving…

Check out our new Amazon Web Services Doc.

Amazon Web Services


AWS Best Practices

Amazon Web Services (AWS) offer a complete set of infrastructure and application services that enable you to run virtually everything in the cloud. Automatic setup is available for some AWS services. Manual setup is requested for others. In any case, it takes less than 5 minutes to setup.


Create An Account

If you have not done so already, you will need to create a Logentries account. You can find more information on creating your account with our getting-started docs.


EC2 Setup

If you do not wish to use the automatic setup script then we have the following manual solutions to forwarding your AWS logs to your Logentries account. Start by choosing your Web Service and follow the instructions given.

There are two options you can use when sending logs to Logentries from an EC2 instance.

Syslog

If you have a cluster of machines for scaling, we recommend using our Token-Based Syslog approach. Create a host on Logentries and add a logfile with the source type set to Token TCP. You will be given a Token UUID which represents that logfile. You can then follow our rsyslog docs on how to use this Token. This will enable you to configure rsyslog the same way on each machine using your Token UUID.

The Agent

We also provide an agent which can be installed on a variety of linux distro’s as well as Windows. This is our command-line tool which allows you to specify which files on the server you would like to ‘follow’ and send to Logentries.

This option doesn’t require you to create anything in the Logentries UI, but you will need to run commands on your instance.


Elastic Beanstalk Setup

Elastic Beanstalk allows you to place a configuration file in your app’s root directory to configure the instance it is launched on.

Syslog

You can utilize our Token-Based Syslog approach with Elastic Beanstalk applications.

First, create a host in your Logentries account. Next, add a logfile with the source type set to Token TCP. You will be given a Token UUID which represents that logfile.

In the root of your app’s directory, create the following hidden directory, .ebextensions and inside that logentriesBeanstalk.config. The copy the following into the config file seen below.

commands: 
    01edit-rsyslog-conf: 
        command: echo '$template LogentriesFormat,"TOKEN %HOSTNAME% %syslogtag%%msg%\n"' > /etc/rsyslog.d/logger.conf 
    02add-second-line: 
        command: echo '*.* @@data.logentries.com:80;LogentriesFormat' >> /etc/rsyslog.d/logger.conf 
    03restart-syslog: 
        command: service rsyslog restart

OpsWorks

OpsWorks allows you to install custom chef recipes and configure their attributes from the AWS dashboard. To use the Logentries chef recipe, add the following git repository to your OpsWorks layer: https://github.com/logentries/le_chef. Then specify a configuration JSON to set attributes for the recipe. The JSON should be structured as:

{
  "le": {
      "account_key":"YOUR LOGENTRIES ACCOUNT KEY GOES HERE",
      "hostname":"",
      "pull-server-side-config": true,
      "logs_to_follow":[{:'name' : 'syslog', 'log': '/var/log/syslog'}]
  }
}

userkey is a required field and should be your Account Key. You can obtain your Account Key by clicking My Account in the left sidebar, followed by Show Account Key on the right hand side.

hostname is the name of this machine as seen in Logentries. Example:MyChefServer

.

logs_to_follow is an array of filepaths belonging to the files you’d like to monitor. /var/log/syslog is monitored by default.

Set the recipe logentries_agent::default to be run during the Setup lifecycle, as shown below.

Back to Top