\chapter{Using \bacula{} catalog to grab information} \label{blb:UseBaculaCatalogToExtractInformationChapter} \index[general]{Statistics} \bacula{} catalog contains lot of information about your IT infrastructure, how many files, their size, the number of video or music files etc. Using \bacula{} catalog during the day to get them permit to save resources on your servers. In this chapter, you will find tips and information to measure bacula efficiency and report statistics. \section{Job statistics} If you (or probably your boss) want to have statistics on your backups to provide some \ac{SLA} indicators, you could use a few \acs{SQL} queries on the \btable{Job} table to report how many: \begin{bitemize} \item jobs have run \item jobs have been successful \item files have been backed up \item \ldots{} \end{bitemize} However, these statistics are accurate only if your job retention is greater than your statistics period. I.e, if jobs are purged from the catalog, you won't be able to use them. Now, you can use the \bcommandname{update stats [days=num]} console command to fill the \btable{JobHisto} table with new Job records. If you want to be sure to take in account only \textbf{good jobs}, ie if one of your important job has failed but you have fixed the problem and restarted it on time, you probably want to delete the first \emph{bad} job record and keep only the successful one. For that simply let your staff do the job, and update \btable{JobHisto} table after two or three days depending on your organization using the \textbf{[days=num]} option. These statistics records aren't used for restoring, but mainly for capacity planning, billings, etc. The \bweb{} interface provides a statistics module that can use this feature. You can also use tools like Talend or extract information by yourself. The \textbf{Statistics Retention = \bbracket{time}} director directive defines the length of time that \bacula{} will keep statistics job records in the Catalog database after the Job End time. (In \btable{JobHisto} table) When this time period expires, and if user runs \bcommandname{prune stats} command, \bacula{} will prune (remove) Job records that are older than the specified period. You can use the following Job resource in your nightly \textbf{BackupCatalog} job to maintain statistics. \begin{bVerbatim} Job { Name = BackupCatalog ... RunScript { Console = "update stats days=3" Console = "prune stats yes" RunsWhen = After RunsOnClient = no } } \end{bVerbatim}