Eventlog updates (#9633)

* Eventlog updates
remove host from eventlog table, retain in api
allow most fields nullable

* updated schema

* revert auth for legacy log_event function
safer check in the model

* add function modifiers
This commit is contained in:
Tony Murray
2019-01-10 00:52:00 -06:00
committed by GitHub
parent 98f75bd9ce
commit daffa7e274
12 changed files with 67 additions and 32 deletions
+5 -7
View File
@@ -941,17 +941,15 @@ function log_event($text, $device = null, $type = null, $severity = 2, $referenc
$device = device_by_id_cache($device);
}
$insert = array('host' => ($device['device_id'] ?: 0),
dbInsert([
'device_id' => ($device['device_id'] ?: 0),
'reference' => ($reference ?: "NULL"),
'type' => ($type ?: "NULL"),
'datetime' => array("NOW()"),
'reference' => $reference,
'type' => $type,
'datetime' => \Carbon\Carbon::now(),
'severity' => $severity,
'message' => $text,
'username' => isset(LegacyAuth::user()->username) ? LegacyAuth::user()->username : '',
);
dbInsert($insert, 'eventlog');
], 'eventlog');
}
// Parse string with emails. Return array with email (as key) and name (as value)