-
-
Save JefStat/98891d947a1bbadedcf25921b116e413 to your computer and use it in GitHub Desktop.
# 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 |
What environment variables did you pass in to your EBS application? I am not able to get this working on my account.
It looks like Elastic Beanstalk sets the environment variables some time after it runs the .ebextensions configs, which means setup-sumo just puts empty strings in for the id/key and any Elastic Beanstalk application deploys or scaling events fail.
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.
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
Ephemeral added
docker container logs added