mirror of https://github.com/MISP/MISP
fix: Use spaces entirely
parent
09aacabe26
commit
a62b23088e
|
@ -6,20 +6,20 @@ class ElasticSearchClient {
|
|||
private $__settings = false;
|
||||
private $__client = false;
|
||||
|
||||
private function __getSetSettings() {
|
||||
$settings = array(
|
||||
'enabled' => false,
|
||||
'connection_string' => 'http://localhost',
|
||||
);
|
||||
private function __getSetSettings() {
|
||||
$settings = array(
|
||||
'enabled' => false,
|
||||
'connection_string' => 'http://localhost',
|
||||
);
|
||||
|
||||
foreach ($settings as $key => $setting) {
|
||||
foreach ($settings as $key => $setting) {
|
||||
$temp = Configure::read('Plugin.ElasticSearch_' . $key);
|
||||
if ($temp) $settings[$key] = $temp;
|
||||
}
|
||||
return $settings;
|
||||
}
|
||||
if ($temp) $settings[$key] = $temp;
|
||||
}
|
||||
return $settings;
|
||||
}
|
||||
|
||||
public function initTool() {
|
||||
public function initTool() {
|
||||
$settings = $this->__getSetSettings();
|
||||
$hosts = explode(",", $settings["connection_string"]);
|
||||
$client = ClientBuilder::create()
|
||||
|
@ -27,10 +27,10 @@ class ElasticSearchClient {
|
|||
->build();
|
||||
$this->__client = $client;
|
||||
$this->__settings = $settings;
|
||||
return $client;
|
||||
}
|
||||
return $client;
|
||||
}
|
||||
|
||||
public function pushDocument($index, $document_type, $document) {
|
||||
public function pushDocument($index, $document_type, $document) {
|
||||
// Format timestamp
|
||||
$time = strftime("%Y-%m-%d %H:%M:%S", strtotime($document["Log"]["created"]));
|
||||
$document["Log"]["created"] = $time;
|
||||
|
@ -41,5 +41,5 @@ class ElasticSearchClient {
|
|||
);
|
||||
|
||||
$this->__client->index($params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue