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

Hostname/Device ID cache seems wrong in Syslog when re-using a hostname

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • None
    • None
    • None

    Description

      We replaced some equipment lastly, but there is a period of time when both the old one and the new one have to be functional.
      So we renamed "hostname" in "hostname-old" and added the new device under the name "hostname".

      Problem : now the logs collected from "hostname" (the new) go under "hostname-old", mixing with the legitimate "hostname-old" logs.

      Syslog sets the $HOST variable correctly : I also write all the logs to a plain text file and these are fine.

      I see in includes/syslog.php that there is a cache of the association hostname-device ID (extract from line 27) :

        $now = time();
        $expired = TRUE;
        if (isset($dev_cache[$host]['lastchecked']))
        {
          if (($dev_cache[$host]['lastchecked'] - $now) < 21600) { $expired = FALSE; } // will expire after 6 hrs
        }
        if ($expired) { $dev_cache[$host]['lastchecked'] = $now; }
      

      But the timestamp in $now will always be superior to $dev_cache[$host]['lastchecked'], so the difference will always be negative, so $expired will always be set to false. That may be why all logs from the new "hostname" go under the device that was formerly named that way.

      I'm not 100% sure this is the cause, I did not dig any further..

      Attachments

        Activity

          People

            adama Adam Armstrong
            babadie Benjamin Abadie
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: