Uploaded image for project: 'Observium'
  1. Observium
  2. OBS-1194

Configuring file logging from the alerting system

Details

    • Improvement
    • Resolution: Won't Do
    • Major
    • None
    • None
    • Alerting
    • None

    Description

      This patch introduces configurable filebased logging to Observium using a template to describe the notification.
      Configuration is done in the local configuration.
      Default configuration is extended with 3 options:

      // File log backend settings
      $config['filelog']['enable'] = FALSE; // Enable/Disable filelog globally
      $config['filelog']['log_dir'] = $config['install_dir'] . '/logs'; // Log dir. No trailing /
      $config['filelog']['log_name'] = 'alerts.log'; // Log name.

      The code has been formatted according to the syntax described on the Observium wiki.
      In order to make this work the alerter needs a described contact_method.
      Insert a contact_method = filelog in the alert_contacts table, and create your mappings by inserting the desired records into alert_contact_assoc.
      These mappings are based on the alert_tests id’s.

      Attachments

        Activity

          [OBS-1194] Configuring file logging from the alerting system

          This was obsoleted by the contact system changes, but can probably be more easily reimplemented now.

          adama Adam Armstrong added a comment - This was obsoleted by the contact system changes, but can probably be more easily reimplemented now.
          gdeboer Gert-Jan de Boer added a comment - - edited

          Attaching the filter we're using to catch the alerts in Elasticsearch.

          Is there a chance you'll accept this patch? I don't see it breaking anything and it helps our use case.

          gdeboer Gert-Jan de Boer added a comment - - edited Attaching the filter we're using to catch the alerts in Elasticsearch. Is there a chance you'll accept this patch? I don't see it breaking anything and it helps our use case.

          Just tested it, with two contacts I get both email and filelog alerts so it seems to work as intended.

          gdeboer Gert-Jan de Boer added a comment - Just tested it, with two contacts I get both email and filelog alerts so it seems to work as intended.

          Updated patch, including newline filter.

          gdeboer Gert-Jan de Boer added a comment - Updated patch, including newline filter.

          We want to feed alerts into elasticsearch so we can search them and correlate them with other systems. Easiest way to accomplish that was getting alerts into a logfile. When you insert two contacts in alert_contacts and add the proper associations in alert_contacts_assoc it should do both email and filelog, wouldn't it?

          gdeboer Gert-Jan de Boer added a comment - We want to feed alerts into elasticsearch so we can search them and correlate them with other systems. Easiest way to accomplish that was getting alerts into a logfile. When you insert two contacts in alert_contacts and add the proper associations in alert_contacts_assoc it should do both email and filelog, wouldn't it?

          Indeed. I think logging to a file is something that should be handled as a special case independent of the notification/contacts system. That can just be hooked into the alert logging functions, I guess.

          adama Adam Armstrong added a comment - Indeed. I think logging to a file is something that should be handled as a special case independent of the notification/contacts system. That can just be hooked into the alert logging functions, I guess.
          landy Mike Stupalov added a comment - - edited

          Anyway we already have function logfile()..
          And yes, we already have alert_log.. can be someone need logging to file

          But anyway I also not know why it need to someone

          landy Mike Stupalov added a comment - - edited Anyway we already have function logfile().. And yes, we already have alert_log.. can be someone need logging to file But anyway I also not know why it need to someone

          but why?

          the way the alerting stuff currently works, enabling this on an alert would disable the default email alerts from being sent.

          adama Adam Armstrong added a comment - but why? the way the alerting stuff currently works, enabling this on an alert would disable the default email alerts from being sent.

          People

            adama Adam Armstrong
            gdeboer Gert-Jan de Boer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: