Configuration of logging facilities

Configuration options should be in the Misc section of the configuration file, except for external facilities.

E-mail

Items that must be configured are:

Recipients address

SetMailAddress=username@hostname

Up to eight addresses are possible, each one at most 63 characters long, each on a seperate line in the configuration file

TipTIP
 

it is recommended to use numerical IP addresses instead of host names (to avoid DNS lookups).

Relay host / Mail exchanger

SetMailRelay=mail.some_domain.com

You may need this option because some sites don't allow outbound e-mail connections from any arbitrary host. If the recipient is offsite, and your site uses a mail relay host to route outbound e-mails, you need to specify the relay host.

Maximum interval

SetMailTime=86400

You may want to set a maximum interval between any two consecutive e-mails, to be sure that samhain is still 'alive'.

Maximum pending

SetMailNum=10

Messages can be queued to send several messages in one e-mail. You may want to set the the maximum number of messages to queue. (Note: messages of highest priority (alert) are always sent immediately.

Multiple recipients

MailSingle=yes/no

If there are multiple recipients, whether to send a single mail with the recipient list, or send multiple mails. If all recipients are on same domain, a single mail may suffice, otherwise it depends on whether the mail server supports forwarding (for security, most don't).

Subject line

MailSubject=string

Here, string may contain the placeholders %T, %H, and/or %M that will get replaced by the time, hostname, and message, respectively. The default subject line is equivalent to "%T %H". This option may be useful if you want to send emails to an email-to-sms gateway.

Example:

  [Misc]  
  # 
  # E-mail receipient (offsite in this case). Up to eight addresses,
  # each one at most 63 characters long.
  # 
  SetMailAddress=username@host.some_domain.com 
  # 
  # Need a relay host for outgoing mail. 
  # 
  SetMailRelay=relay.mydomain.com 
  #  
  # Number of pending mails. 
  # 
  SetMailNum=10 
  #  
  # Maximum time between e-mails. 
  # Want a message every day, just to be sure that the 
  # program still runs. 
  # 
  SetMailTime=86400
  #  
  # To all recipients in a single mail. 
  MailSingle=yes 

Log file

Log server

External facilities

samhain can invoke external scripts/programs for logging (i.e. to implement support for pagers etc.). This is explained in detail in the chapter called Hooks for External Programs>.