Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-10158

Provide a way to configure the date formats used by the Syslog NBI

    XMLWordPrintable

    Details

    • Sprint:
      Horizon - May 23rd 2018, Horizon - May 30th 2018

      Description

      A customer has found a discrepancy when comparing how the Syslog Northbounder behaves on Meridian 2016 (their production environment0 and latest Horizon (their development environment).

      For example, let's say that the message template is configured like this:

      <message-format>ALARM ID:${alarmId} NODE:${nodeLabel} IP:${ipAddr} FIRST:${firstOccurrence} LAST:${lastOccurrence} COUNT:${count} UEI:${alarmUei} SEV:${severity} ${logMsg}</message-format>

      On Meridian 2016, the message is rendered like this:

      ALARM ID:7886101 NODE:server01 IP:10.0.0.1 FIRST:2016-11-02 08:35:29.686 LAST:2017-02-06 13:18:04.507 COUNT:85466 ...

      Note the format of the dates.

      On latest develop (in their case the Drift Branch Build 90), the message is rendered like this:

      ALARM ID:16554 NODE:server01 IP:10.0.0.1 FIRST:2018-05-01T05:06:32-05:00 LAST:2018-05-11T07:41:39-05:00 COUNT:2526 ...

      As you can see the format is different. Note the date format is 2018-05-01T05:06:32-05:00 for Horizon and 2016-11-02 08:35:29.686 for Meridian. This has cause mapping issues in a third party application the customer is using to receive and process the syslog messages forwarded by the Syslog NBI; which is why the customer would like to have the format you see on the old Meridian on newer versions.

      In my opinion, the best way could be either enhance the Syslog NBI configuration to provide a format for the dates that affects the rendered messages; for example:

      <syslog-northbounder-config>
         <enabled>true</enabled>
         <nagles-delay>1000</nagles-delay>
         <batch-size>100</batch-size>
         <queue-size>300000</queue-size>
         <date-format>yyyy-MM-dd HH:mm:ss.SSS</date-format>
      ...

      Or, provide a format while using the placeholders for dates; for example:

      <message-format>ALARM ID:${alarmId} NODE:${nodeLabel} IP:${ipAddr} FIRST:${firstOccurrence::yyyy-MM-dd HH:mm:ss.SSS} LAST:${lastOccurrence::yyyy-MM-dd HH:mm:ss.SSS} COUNT:${count} UEI:${alarmUei} SEV:${severity} ${logMsg}</message-format>

      Note that the format is shown after "a separator" (in this case, "::").

      I personally find the second option more flexible and powerful.

        Attachments

          Activity

            People

            • Assignee:
              cgorantla Chandra Gorantla
              Reporter:
              agalue Alejandro Galue
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: