Skip to content

Instantly share code, notes, and snippets.

@baohouse
Forked from jorihardman/sumo_logic.config
Created May 25, 2020 19:04
Show Gist options
  • Save baohouse/60ff2dcca4b1fc4e0a4d27dc122d6c89 to your computer and use it in GitHub Desktop.
Save baohouse/60ff2dcca4b1fc4e0a4d27dc122d6c89 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
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=@@SUMO_SOURCE_CATEGORY
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/*",
"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:
01_replace_sumo_vars:
command: sed -i -e "s,@@SUMO_SOURCE_CATEGORY,${SUMO_SOURCE_CATEGORY},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