A little niggle I have with installed Sumo Logic collectors is being unable to change their name after the initial launch. So, when baking AMIs to launch EC2 instances you will need some extra steps to avoid having all your collectors named after your baking instance. Sumo Logic’s guide covers this.
If you’re using a Linux distribution with systemd (e.g. Ubuntu 16.04), to make the collector install a little neater add a start-up script. SL provide an example.
This will all work great - but, the collector name will equal the initial instance hostname (e.g.
ip-172-17-13-184). When using EC2 instances across multiple accounts and giving your AMI to different Dev teams, not having an easily traceable collector name can be a problem. Hence the post!
A solution is to extend the example start-up script to instead call a bash script:
This example script will set the collector name using the EC2 metadata service:
Now your collector will have a unique identifier, which can make the task of compareing active collectors (using the SL API) against your EC2 inventory (CIS #1) much much easier.