Introduction
Salt or SaltStack is an infrastructure management tool for managing hundreds of Computer Systems by using high-speed communication. It is built using Python. It uses a simple and human-readable language YAML; hence programming knowledge is not required to use Salt.
You can automate the deployment and configure complex IT systems by using Salt.
Salt works on the master-slave model. Using the Master, you can send commands and perform system configuration of the Slave systems. The Slaves are called Minions in Salt/SaltStack.

In this article, we will discuss how to store the Job results in Salt.
Storing Job Results
After performing some tasks, Salt stores the results obtained in a storage called the Default Job Cache.
Default Job Cache
When the results are returned from the Salt Minion to the Salt Master, it is stored in temporary storage called the Default Job Cache in which the results are stored for a period of 24(twenty-four) hours. The data will be stored in the local storage of the Salt Master.
Increase the Storage Period
The default duration for storing the data can be adjusted by configuring the keep-jobs parameter of the Salt Master configuration file. The value passed to this parameter is in hours.
Usage:
keep-jobs: 36
The above configuration will store the data for 36 hours.
Disable Job Cache
You can also disable the job cache for some jobs. To disable the job cache, set the job-cache parameter to False in the salt master configuration files.
Usage:
job-cache: False
The above configuration will disable the caching of job results obtained from the minions.
As we mentioned before, the data is stored in the local storage of the Salt Master.
Salt provides two mechanisms for storing the cache data in external databases (like, SQL, Redis, Syslog) instead of the local storage of the Salt Master - the First is by using the External Job Cache and the Second is by using the Master Job Cache.
The difference between these two methods is - who is returning the data? The Salt Master or the Salt Minion?
External Job Cache (Minion Side Returner)
After performing a job, the Salt Minions send the results to the Salt Master.
When this configuration is used, the results generated by the Salt Minions will be sent to the Salt Master as well as to the External Cache (like SQL, Redis, Syslog). The job of sending the data from the Minions to the External Cache is done by the Salt Runner module running on the Salt Minions.
👍 Advantages
The advantage of this configuration is that NO additional load is put on the Salt Master since the data is being sent to the External Storage by the Salt Minion itself.
👎 Disadvantages
Since the Salt Minions have to send the results to the Salt Master as well as the External Database, the load on the Salt Minion increases by a large amount. The number of connections also increases and maintaining so many connections is quite difficult.
Master Job Cache (Master Side Returner)
In this type of Configuration, the results are first sent from the Salt Minion to the Salt Master and then they are sent to the External Cache by the Salt Master, unlike the External Job cache configuration, in which the Salt Minion sent the results to the Salt Master as well as the External Cache.
👍 Advantages
Since data is being sent to the Salt Master and then to the External Cache, only one connection will be used (since there is only one master, only one connection between the Salt Master and the External Cache is needed.)
👎 Disadvantages
The load on the Salt Master increases.
Now that we have discussed, the differences between the two configurations for sending data to the External Cache, let’s discuss how to configure the External and Master Job Cache.




