Last active
September 25, 2020 21:15
-
-
Save JefStat/98891d947a1bbadedcf25921b116e413 to your computer and use it in GitHub Desktop.
Elastic Beanstalk Sumo Logic Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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