]> granicus.if.org Git - icinga2/commitdiff
db_ido: Add object_id for logentries.
authorMichael Friedrich <Michael.Friedrich@netways.de>
Thu, 3 Oct 2013 01:41:47 +0000 (03:41 +0200)
committerMichael Friedrich <Michael.Friedrich@netways.de>
Thu, 3 Oct 2013 01:41:47 +0000 (03:41 +0200)
see https://dev.icinga.org/issues/4754 for the extension.

components/db_ido_mysql/schema/mysql.sql
lib/db_ido/servicedbobject.cpp

index 2d16fb2ac85bdcde86a745ab3f2fdd948eec7ce6..32f320cef865f66a376d31b8d0a3071c2c7c6d28 100644 (file)
@@ -819,6 +819,7 @@ CREATE TABLE IF NOT EXISTS icinga_logentries (
   logentry_data TEXT character set latin1  default '',
   realtime_data smallint default 0,
   inferred_data_extracted smallint default 0,
+  object_id bigint unsigned default NULL,
   PRIMARY KEY  (logentry_id)
 ) ENGINE=InnoDB COMMENT='Historical record of log entries';
 
index e1f52392699d08293d095d17c9b059a4345c2a90..f9832658338f39e7a033391fc59e7afc5d11b4ba 100644 (file)
@@ -1256,7 +1256,7 @@ void ServiceDbObject::AddLogHistory(const Service::Ptr& service, String buffer,
        fields1->Set("logentry_time", DbValue::FromTimestamp(entry_time));
        fields1->Set("entry_time", DbValue::FromTimestamp(entry_time));
        fields1->Set("entry_time_usec", entry_time_usec);
-       //fields1->Set("object_id", service); // not supported in 1.x see #4754
+       fields1->Set("object_id", service); // added in 1.10 see #4754
        fields1->Set("logentry_type", type);
        fields1->Set("logentry_data", buffer);
 
@@ -1265,13 +1265,11 @@ void ServiceDbObject::AddLogHistory(const Service::Ptr& service, String buffer,
        query1.Fields = fields1;
        OnQuery(query1);
 
-       /*
        if (host->GetCheckService() == service) {
-               //fields1->Set("object_id", host); // not supported in 1.x see #4754
+               fields1->Set("object_id", host); // added in 1.10 see #4754
                query1.Fields = fields1;
                OnQuery(query1);
        }
-       */
 }
 
 /* flappinghistory */
@@ -1466,4 +1464,4 @@ void ServiceDbObject::AddExternalCommandHistory(double time, const String& comma
 
        query1.Fields = fields1;
        OnQuery(query1);
-}
\ No newline at end of file
+}