Skip to content

Instantly share code, notes, and snippets.

@xntric78
Forked from bwhaley/gist:6471649
Last active July 14, 2017 13:49
Show Gist options
  • Save xntric78/46014e54f51a7ab71254d68b05c9d2d8 to your computer and use it in GitHub Desktop.
Save xntric78/46014e54f51a7ab71254d68b05c9d2d8 to your computer and use it in GitHub Desktop.
Use this little script as EC2 User Data to install a Sumo Logic collector. Be sure to base64 encode it.
cat > /usr/local/SumoCollector/config/custom_sources.json << END
{
"api.version": "v1",
"sources": [
{
"sourceType": "LocalFile",
"name": "JMeter Results",
"pathExpression": "/home/ec2-user/results/*.jtl",
"blacklist": "",
"category": "jload/engine/results",
"useAutolineMatching": false,
"multilineProcessingEnabled": false,
"timeZone": "UTC",
"automaticDateParsing": true,
"forceTimeZone": false,
"defaultDateFormat": "dd/MMM/yyyy HH:mm:ss"
},
{
"sourceType": "LocalFile",
"name": "JMeter Logs",
"pathExpression": "/home/ec2-user/logs/*.log",
"blacklist": "",
"category": "jload/engine/logs",
"useAutolineMatching": false,
"multilineProcessingEnabled": false,
"timeZone": "UTC",
"automaticDateParsing": true,
"forceTimeZone": false,
"defaultDateFormat": "dd/MMM/yyyy HH:mm:ss"
}
]
}
END
curl -o /tmp/sumo.sh https://collectors.sumologic.com/rest/download/linux/64
sh /tmp/sumo.sh -q -dir "/usr/local/SumoCollector"
-q -VskipRegistration=true -Vephemeral=true -Vsources=/path/to/sources.json -Vsumo.accessid=<access_id> -Vsumo.accesskey=<access_key>
/etc/init.d/collector stop
cat > /etc/sumo.conf << END
name=<collector name> #Omit this line to use the hostname
ephemeral=true
accessid=randomaccessid
accesskey=randomaccesskey
sources=/usr/local/SumoCollector/config/custom_sources.json
END
/etc/init.d/collector start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment