NAME
eris::role::schema - Role for implementing a schema
VERSION
version 0.008
SYNOPSIS
To implement a schema that takes the processed log entry without field filtering, you could:
package my::app::schema::full;
use Moo;
with qw(eris::role::schema);
sub _build_flatten { 0 }
sub _build_use_dictionary { 0 }
sub match_log { 1 }
ATTRIBUTES
index_name_strftime
Defaults to a daily index pattern, '%Y.%m.%d' per Logstash.
index_name
Defaults to taking the schema's class, trimming off the namespace and then replacing '::' with an underscore. It then joins this with index_name_strftime
to form the index name that's evaluated foreach document.
Without overriding this via a config element, we get:
Schema Class Index Name
-------------------- --------------
eris::schema::syslog yslog-%Y.%m.%d
eris::schema::access ccess-%Y.%m.%d
my::app::schema::log y_app_schema_log-%Y.%m.%d
default_type
The type for the Elasticsearch index to assume. Defaults to 'log'.
types
A HashRef of valid types for the Elasticsearch index, defaults to just the default_type.
dictionary
An instance of eris::dictionary configured for the schema. Parameters passed via the dictionary
sub section of the config will be used to build the dictionary.
use_dictionary
A boolean, if true the fields in the document will be filtered by the dictionary
element.
dictionaries
A hashref to configure the loading the dictionaries. Defaults to empty.
final
Boolean, defaults to true. If true this schema "steals" the document and the only one bulk item will be appended to the as_bulk
per document. Set to false to indexing the same log into multiple indices.
You'll need to consider the priority of the schema if you set this to false to ensure the schema is early enough in the chain to accept the document.
flatten
Boolean, defaults to true. If true only the context hash from the eris::log object is indexed. If set to false, the complete
hash is used instead.
es_version
The ElasticSearch version to target for commands and mappings. Defaults to 6.4.
es_template
The ElasticSearch index template definition from this schema.
METHODS
as_bulk
Takes an eris::log object and returns the bulk newline delimited JSON to add that object to the cluster.
to_document
Takes an eris::log object and returns a hash reference representing that document for indexing.
INTERFACE
match_log()
Takes an eris::log
and determines if this schema applies.
Returns boolean
AUTHOR
Brad Lhotsky <brad@divisionbyzero.net>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by Brad Lhotsky.
This is free software, licensed under:
The (three-clause) BSD License