Reputation: 978
I have lots of servers (over 50) all getting their configuration from Salt Stack (and I love it so far). But all of that automation makes me worried a bit. If I schedule salt to run highstate on all servers every night, how can I ensure the changes are being applied correctly? Can I log the changes so that I can either review any changes to my servers daily or at least troubleshoot what salt magically changes over night?
Right now if I run salt '*' state.highstate on the master, I get many pages of output to the screen and then have to scroll a lot to find any changes. Also, this process is manual. I'd like something scheduled and automated.
Upvotes: 1
Views: 3039
Reputation: 1412
By default, data about jobs runs from the Salt is returned to the master. Specifying returners will ensure that the data is also sent to the specified returner interfaces.
Specifying what returners to use is done when the command is invoked:
salt '*' test.ping --return smtp_return
It can be useful to include specific data to differentiate a job from other jobs. Take for example the schedule module. By using the metadata parameter a value can be associated with a scheduled job, although these metadata values aren't used in the execution of the job they can be used to search for specific job later.
job1:
schedule.present:
- function: state.apply
- seconds: 1800
- splay: 5
- metadata:
foo: bar
An example job search on the salt-master might look similar to this:
salt-run jobs.list_jobs search_metadata='{"foo": "bar"}'
Take a look at the salt.runners.jobs and the returners documentation for more examples.
Upvotes: 1
Reputation: 978
One possibility that I'm considering is to increase the Log Level on the minion to info. Then use logstash to consume /var/log/salt/minion and use Elasticsearch or Kibana monitor changes to the logs.
Upvotes: 0