.. _MessagesChapter:

Messages Configuration
======================



.. _ResourceMessages:

 :index:`\ <single: Resource; Messages>`\  :index:`\ <single: Messages Resource>`\

Messages Resource
-----------------

The Messages resource defines how messages are to be handled and destinations to which they should be sent.

Even though each daemon has a full message handler, within the |fd| and the |sd|, you will normally choose to send all the appropriate messages back to the |dir|. This permits all the messages associated with a single Job to be combined in the Director and sent as a single email message to the user, or logged together in a single file.

Each message that Bareos generates (i.e. that each daemon generates) has an associated type such as INFO, WARNING, ERROR, FATAL, etc. Using the message resource, you can specify which message types you wish to see and where they should be sent. In addition, a message may be sent to multiple destinations. For example, you may want all error messages both logged as well as sent to you in an email. By defining multiple messages resources, you can have different message handling for each type of Job
(e.g. Full backups versus Incremental backups).

In general, messages are attached to a Job and are included in the Job report. There are some rare cases, where this is not possible, e.g. when no job is running, or if a communications error occurs between a daemon and the director. In those cases, the message may remain in the system, and should be flushed at the end of the next Job.

The records contained in a Messages resource consist of a destination specification followed by a list of message-types in the format: :index:`\ <single: Messages; destination>`\

destination = message-type1, message-type2, message-type3, ...

or for those destinations that need and address specification (e.g. email):

destination = address = message-type1, message-type2, message-type3, ...
   |
   | where

   destination
      is one of a predefined set of keywords that define where the message is to be sent (:config:option:`dir/messages/Append`\ , :config:option:`dir/messages/Console`\ , :config:option:`dir/messages/File`\ , :config:option:`dir/messages/Mail`\ , ...),

   address
      varies according to the destination keyword, but is typically an email address or a filename,

   :ref:`message-type <MessageTypes>`
      is one of a predefined set of keywords that define the type of message generated by Bareos: ERROR, WARNING, FATAL, ...

































.. include:: /include/autogenerated/bareos-dir-resource-messages-table.rst.inc

.. include:: /include/autogenerated/bareos-dir-resource-messages-description.rst.inc

.. _MessageTypes:

Message Types
-------------

For any destination, the message-type field is a comma separated list of the following types or classes of messages:

info
   |
   | :index:`\ <single: Messages; type; info>`\  General information messages.

warning
   |
   | :index:`\ <single: Messages; type; warning>`\  Warning messages. Generally this is some unusual condition but not expected to be serious.

error
   |
   | :index:`\ <single: Messages; type; error>`\  Non-fatal error messages. The job continues running. Any error message should be investigated as it means that something went wrong.

fatal
   |
   | :index:`\ <single: Messages; type; fatal>`\  Fatal error messages. Fatal errors cause the job to terminate.

terminate
   |
   | :index:`\ <single: Messages; type; terminate>`\  Message generated when the daemon shuts down.

notsaved
   |
   | :index:`\ <single: Messages; type; notsaved>`\  Files not saved because of some error. Usually because the file cannot be accessed (i.e. it does not exist or is not mounted).

skipped
   |
   | :index:`\ <single: Messages; type; skipped>`\  Files that were skipped because of a user supplied option such as an incremental backup or a file that matches an exclusion pattern. This is not considered an error condition such as the files listed for the notsaved type because the configuration file explicitly requests these types of files to be skipped. For example, any unchanged file during an incremental backup, or any subdirectory if the no recursion option is specified.

mount
   |
   | :index:`\ <single: Messages; type; mount>`\  Volume mount or intervention requests from the Storage daemon. These requests require a specific operator intervention for the job to continue.

restored
   |
   | :index:`\ <single: Messages; type; restored>`\  The ls style listing generated for each file restored is sent to this message class.

all
   |
   | :index:`\ <single: Messages; type; all>`\  All message types.

security
   |
   | :index:`\ <single: Messages; type; security>`\  Security info/warning messages principally from unauthorized connection attempts.

alert
   |
   | :index:`\ <single: Messages; type; alert>`\  Alert messages. These are messages generated by tape alerts.

volmgmt
   |
   | :index:`\ <single: Messages; type; volmgmt>`\  Volume management messages. Currently there are no volume management messages generated.

audit
   |
   | :index:`\ <single: Messages; type; audit>`\  :index:`\ <single: auditing>`\  Audit messages. Interacting with the Bareos Director will be audited. Can be configured with in resource :config:option:`dir/director/Auditing`\ .

The following is an example of a valid Messages resource definition, where all messages except files explicitly skipped or daemon termination messages are sent by email to backupoperator@example.com. In addition all mount messages are sent to the operator (i.e. emailed to backupoperator@example.com). Finally all messages other than explicitly skipped files and files saved are sent to the console:

.. code-block:: bareosconfig
   :caption: Message resource

   Messages {
     Name = Standard
     Mail = backupoperator@example.com = all, !skipped, !terminate
     Operator = backupoperator@example.com = mount
     Console = all, !skipped, !saved
   }

With the exception of the email address, an example Director’s Messages resource is as follows:

.. code-block:: bareosconfig
   :caption: Message resource

   Messages {
     Name = Standard
     Mail Command = "/usr/sbin/bsmtp -h mail.example.com  -f \"\(Bareos\) %r\" -s \"Bareos: %t %e of %c %l\" %r"
     Operator Command = "/usr/sbin/bsmtp -h mail.example.com -f \"\(Bareos\) %r\" -s \"Bareos: Intervention needed for %j\" %r"
     Mail On Error = backupoperator@example.com = all, !skipped, !terminate
     Append = "/var/log/bareos/bareos.log" = all, !skipped, !terminate
     Operator = backupoperator@example.com = mount
     Console = all, !skipped, !saved
   }
