Class ElasticSearch
Anbindung an ElasticSearch
Die ElasticSearch bindet eine ElasticSearch Instanz an Alvine und stellt somit ein mächtiges Werkzeug für die Auswertung von Logdateien zur Verfügung.
ACHTUNG: Dieser Logger darf nicht an den NETWORKING und HTTP Channel gebunden werden, da es sonst zur einer Rekursion kommen kann!
Vor dem Verwenden muss in ElasticSearch der Index folgendermassen angelegt werden.
# Ggf vorher löschen curl -XDELETE 'http://example.com:9200/alvine-logs' # Anlegen curl -XPUT 'http://example.com:9200/alvine-logs' -d '{ "mappings": { "logs" : { "properties" : { "date" : { "type" : "date", "format": "dateOptionalTime" }, "record-type" : { "type" : "string" }, "process-id" : { "type" : "integer" }, "maschine-type" : { "type" : "string" }, "php-release" : { "type" : "string" }, "log-level" : { "type" : "string" }, "message" : { "type" : "string", "index" : "not_analyzed" }, "logger" : { "type" : "string" }, "host" : { "type" : "string" }, "operation-system" : { "type" : "string" }, "text" : { "type" : "string", "index" : "analyzed", "null_value" : "na" } } } } }'
// LoggrHandler $handler = new \Alvine\Util\Logging\Handler\ElasticSearch($uri); // Logger $logger = \Alvine\Util\Logging\Logger::getLogger(); // Meldungen mit unterschiedlichen Level ausgeben. $logger->logTrace('Dies ist ein Log-Trace'); $logger->logDebug('Und eine Log-Debug Zeile!');
- Alvine\Core\Alvine implements Serializable uses Alvine\Core\SerializableImplementation
- Alvine\Util\Logging\Handler implements Alvine\Util\Logging\Filter, Alvine\Core\InstantiableFromProperties
- Alvine\Util\Logging\Handler\HTTP
- Alvine\Util\Logging\Handler\ElasticSearch
Namespace: Alvine\Util\Logging\Handler
Package: Alvine\Util\Logging\Handler
Category: Framework
License: Licence
Author: schukai GmbH info@schukai.de
Version: Release: $Revision: 173 $
Since: 20150911
Link: Alvine
Located at util/logging/handler/ElasticSearch.class.php
Package: Alvine\Util\Logging\Handler
Category: Framework
License: Licence
Author: schukai GmbH info@schukai.de
Version: Release: $Revision: 173 $
Since: 20150911
Link: Alvine
Located at util/logging/handler/ElasticSearch.class.php
public
|
#
__construct(
Neues Loggr-Objekt erstellen |
protected
|
#
getMappedFields(
Die Felder des LogRecords auf die von ElasticSearch Mappen |
protected
|
|
public static
|
#
getInstanceFromProperties(
Erstellt ein neues HTTPHandle-Objekt und initialisiert Werte über ein Properties-Objekt. Die gültigen Eigenschaften sind: |
close(),
flush(),
setValue()
|
__destruct(),
getEncoding(),
getFilter(),
getFormatter(),
getThreshold(),
isLoggable(),
publish(),
setEncoding(),
setFilter(),
setFormatter(),
setFromProperties(),
setThreshold()
|
__call(),
__clone(),
__get(),
__set(),
__toString(),
equals(),
getClass(),
getClone(),
getClosure(),
getHashCode(),
getID(),
getShortID(),
isCallable(),
isInstanceOf(),
propertyExists()
|
serialize(),
unserialize()
|
checkAndAdjustSerialisation(),
serialize(),
unserialize()
|
string |
INDEX
Anwendungslog |
#
'/alvine-logs/entry/'
|
APIVERSION,
IDENTIFICATION,
SERIALVERSION,
VERSION
|
$preset,
$uri
|
$buffer,
$encoding,
$filter,
$formatter,
$loggable,
$threshold
|
$hash,
$properties
|