Skip to content

Instantly share code, notes, and snippets.

@JefStat
Last active September 25, 2020 21:15
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save JefStat/98891d947a1bbadedcf25921b116e413 to your computer and use it in GitHub Desktop.
Save JefStat/98891d947a1bbadedcf25921b116e413 to your computer and use it in GitHub Desktop.
Elastic Beanstalk Sumo Logic Config
# This will automatically install the Sumo Logic collector on AWS Elastic
# Beanstalk instances. Add this to the .ebextensions folder in your app root
# To add or remove tracked files, simply add or remove source hashes to the
# sources array.
packages:
rpm:
SumoCollector: https://collectors.sumologic.com/rest/download/rpm/64
services:
sysvinit:
collector:
enabled: true
ensureRunning: true
files:
"/home/ec2-user/setup-sumo.sh":
mode: "000755"
owner: root
group: root
content: |
cat >/opt/SumoCollector/config/user.properties <<EOL
accessid=$SUMOLOGIC_ACCESS_ID
accesskey=$SUMOLOGIC_ACCESS_KEY
category=$SUMOLOGIC_SOURCE_CATEGORY
rpmAutoStart=false
syncSources=/etc/sumo-sources.json
ephemeral=true
syncSources=/opt/SumoCollector/config/sumo_sources.json
sources=/opt/SumoCollector/config/sumo_sources.json
EOL
"/opt/SumoCollector/config/sumo_sources.json":
mode: "000755"
owner: root
group: root
content: |
{
"api.version": "v1",
"sources": [
{
"sourceType": "LocalFile",
"pathExpression": "/var/log/eb-docker/containers/eb-current-app/*.log",
"multilineProcessingEnabled": true,
"useAutolineMatching": true,
"automaticDateParsing": true
}
]
}
"/opt/elasticbeanstalk/tasks/taillogs.d/sumo-logic.conf" :
mode: "000755"
owner: root
group: root
content: |
/opt/SumoCollector/logs/*
"/opt/elasticbeanstalk/tasks/bundlelogs.d/sumo-logic.conf" :
mode: "000755"
owner: root
group: root
content: |
/opt/SumoCollector/logs/*
"/opt/elasticbeanstalk/tasks/publishlogs.d/sumo-logic.conf" :
mode: "000755"
owner: root
group: root
content: |
/opt/SumoCollector/logs/*
container_commands:
setup_sumo:
command: /home/ec2-user/setup-sumo.sh
@dimamix
Copy link

dimamix commented Nov 23, 2017

One observations from our experience after launching this: Each item in the sources array must also include a name property. Without it, no source was detected or defined.

@rcollette
Copy link

Forked to add source names, order properties as executed according to AWS documentation, and restart the service since the user.properties file is not present before service start. Beanstalk environment variables work just fine.
https://gist.github.com/rcollette/95667454dc054d9d308e5b4d9a80f419

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment