Last active
October 4, 2018 14:41
-
-
Save antonioned/9077644d1dc4be2ab88c30962fa47d15 to your computer and use it in GitHub Desktop.
Sumologic - Elastic Beanstalk integration
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 is the .config file that I am using for installing, configuring and deploying sumologic to Elastic Beanstalk. | |
The file does all the neccessar changes to the sumologic files in order to install the Collector and start it with the accessid and accesskey that are set up in the Beanstalk env. variables. | |
After installing is done, all the files are edited so that the collector can use the Local File Configuration and read sources from the dev-sources.json file. | |
This is the one I am using for dev, the tests in the container command express that. You can set up the ENV_NAME with the name of your Beanstalk environment and run the commands only on the env you need. | |
A setup-sumo-prod.sh with production values can be set and run only on prod. |
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
files: | |
"/home/ec2-user/setup-sumo-dev.sh": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
cat >/opt/SumoCollector/config/user.properties <<EOL | |
accessid=$SUMOLOGIC_ACCESS_ID | |
accesskey=$SUMOLOGIC_ACCESS_KEY | |
rpmAutoStart=false | |
sourceSyncMode=Json | |
ephemeral=true | |
syncSources=/opt/SumoCollector/config/dev-sources.json | |
sources=/opt/SumoCollector/config/dev-sources.json | |
EOL | |
SUMOLOGIC_ACCESS_ID=$(sudo /opt/elasticbeanstalk/bin/get-config environment -k SUMOLOGIC_ACCESS_ID) | |
SUMOLOGIC_ACCESS_KEY=$(sudo /opt/elasticbeanstalk/bin/get-config environment -k SUMOLOGIC_ACCESS_KEY) | |
"/opt/SumoCollector/config/dev-sources.json": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
{ | |
"api.version":"v1", | |
"sources": [ | |
{ | |
"name":"development/nodejs", | |
"category":"development/nodejs", | |
"sourceType": "LocalFile", | |
"pathExpression": "/var/log/nodejs/nodejs.log", | |
"multilineProcessingEnabled": true, | |
"useAutolineMatching": true, | |
"automaticDateParsing": true | |
}, | |
{ | |
"name":"development/nginx-access", | |
"category":"development/nginx-access", | |
"sourceType": "LocalFile", | |
"pathExpression": "/var/log/nginx/access.log", | |
"multilineProcessingEnabled": true, | |
"useAutolineMatching": true, | |
"automaticDateParsing": true | |
}, | |
{ | |
"name":"development/nginx-error", | |
"category":"development/nginx-error", | |
"sourceType": "LocalFile", | |
"pathExpression": "/var/log/nginx/error.log", | |
"multilineProcessingEnabled": true, | |
"useAutolineMatching": true, | |
"automaticDateParsing": true | |
}, | |
{ | |
"name":"development/eb-activity", | |
"category":"development/eb-activity", | |
"sourceType": "LocalFile", | |
"pathExpression": "/var/log/eb-activity.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: | |
00_get_env_vars: | |
test: "[ `{\"Ref\": \"AWSEBEnvironmentName\"}` = \"ENV_NAME\" ]" | |
command: SUMOLOGIC_ACCESS_ID=$(sudo /opt/elasticbeanstalk/bin/get-config environment -k SUMOLOGIC_ACCESS_ID) && SUMOLOGIC_ACCESS_KEY=$(sudo /opt/elasticbeanstalk/bin/get-config environment -k SUMOLOGIC_ACCESS_KEY) | |
01_install_sumo: | |
test: "[ `{\"Ref\": \"AWSEBEnvironmentName\"}` = \"ENV_NAME\" ]" | |
command: sudo wget "https://collectors.us2.sumologic.com/rest/download/linux/64" -O SumoCollector.sh && sudo chmod +x SumoCollector.sh && sudo ./SumoCollector.sh -q -Vsumo.accessid=$SUMOLOGIC_ACCESS_ID -Vsumo.accesskey=$SUMOLOGIC_ACCESS_KEY | |
02_setup_sumo: | |
test: "[ `{\"Ref\": \"AWSEBEnvironmentName\"}` = \"ENV_NAME\" ]" | |
command: /home/ec2-user/setup-sumo-dev.sh | |
03_restart_sumo: | |
test: "[ `{\"Ref\": \"AWSEBEnvironmentName\"}` = \"ENV_NAME\" ]" | |
command: cd /opt/SumoCollector && sudo ./collector restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment