Commit e0d6f0a8e8b5ff97f566900156fb0c6d9d193b18
1 parent
05eb7c0d8e
Exists in
master
and in
2 other branches
Changed the format of the message to be published from xlsiem
Showing 1 changed file with 8 additions and 3 deletions
api/app/Http/Controllers/V1/Partners/XlsiemController.php
View file @
e0d6f0a
... | ... | @@ -28,12 +28,10 @@ |
28 | 28 | 'priority' => isset($ev['priority']) ? $ev['priority'] : null, |
29 | 29 | 'confidence' => isset($ev['confidence']) ? $ev['confidence'] : null, |
30 | 30 | ]; |
31 | - $mqttEvents[] = [ | |
32 | - 'asset_id' => $request->get('asset_id'), | |
31 | + $eventAlarms[] = [ | |
33 | 32 | 'event_alarm_id' => $ev['event_alarm_id'], |
34 | 33 | 'event_alarm_char' => $ev['event_alarm_char'], |
35 | 34 | 'name' => isset($ev['name']) ? $ev['name'] : null, |
36 | - 'time' => Carbon::createFromTimestamp($request->get('timestamp')), | |
37 | 35 | 'source_ip' => $ev['source_ip'], |
38 | 36 | 'source_port' => isset($ev['source_port']) ? $ev['source_port'] : null, |
39 | 37 | 'destination_ip' => $ev['destination_ip'], |
40 | 38 | |
... | ... | @@ -41,7 +39,14 @@ |
41 | 39 | 'priority' => isset($ev['priority']) ? $ev['priority'] : null, |
42 | 40 | 'confidence' => isset($ev['confidence']) ? $ev['confidence'] : null |
43 | 41 | ]; |
42 | + Mqtt::ConnectAndPublish('xlsiem/event', json_encode($mqttEvents), 1); | |
44 | 43 | } |
44 | + $mqttEvents = { | |
45 | + 'asset_id' => $request->get('asset_id'), | |
46 | + 'timestamp' => Carbon::createFromTimestamp($request->get('timestamp')), | |
47 | + 'event_alarm' => $eventAlarms | |
48 | + }; | |
49 | + | |
45 | 50 | |
46 | 51 | // publish to MQTT Broker |
47 | 52 | //Mqtt::ConnectAndPublish('xlsiem/event', json_encode($mqttEvents), $request->user()->id); |