Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fgarsombke/f939a8b8d5f2e398eb696d5e3334645b to your computer and use it in GitHub Desktop.
Save fgarsombke/f939a8b8d5f2e398eb696d5e3334645b to your computer and use it in GitHub Desktop.
SumoLogic with ElasticBeanstalk, you're welcome :)
# 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
files:
"/home/ec2-user/setup-sumo.sh":
mode: "000755"
owner: root
group: root
content: |
cat >/opt/SumoCollector/config/user.properties <<EOL
accessid=@@SUMO_ACCESS_ID
accesskey=@@SUMO_ACCESS_KEY
category=@@ENV/2_x/api
rpmAutoStart=false
ephemeral=true
syncSources=/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",
"name": "web log",
"pathExpression": "/var/log/web-1*.log",
"multilineProcessingEnabled": true,
"useAutolineMatching": true,
"automaticDateParsing": true
}
]
}
container_commands:
01_replace_sumo_vars:
command: sed -i -e "s,@@ENV,${ENV},g; s,@@SUMO_ACCESS_ID,${SUMO_ACCESS_ID},g; s,@@SUMO_ACCESS_KEY,${SUMO_ACCESS_KEY},g" /home/ec2-user/setup-sumo.sh
02_setup_sumo:
command: /home/ec2-user/setup-sumo.sh
03_restart_sumo:
command: service collector restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment