Skip to content

Instantly share code, notes, and snippets.

@rgbkrk
Last active August 29, 2015 13:56
Show Gist options
  • Save rgbkrk/9143556 to your computer and use it in GitHub Desktop.
Save rgbkrk/9143556 to your computer and use it in GitHub Desktop.
Ripping logs from salt minions

Need a rapid way of pulling your logs back using salt? With one config option in /etc/salt/master and two quick commands, you can do this in parallel across your boxes.

First, use archive.tar to tarball up your logs

salt '*' archive.tar cvzf /tmp/logs.tgz /var/log/

Next up, cp.push to pull the logs back from the minions up to the master

In order to use cp.push, you'll need to set file_recv to True within /etc/salt/master.

# /etc/salt/master
...
file_recv=True

Then restart the master

service restart salt-master

Now simply push the logs from the minion to the master.

salt '*' cp.push /tmp/logs.tgz

They'll end up in /var/cache/salt/master/minions/<minion_id>/files/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment