NAME

eris::log - Structured log or event object implementation

VERSION

version 0.005

SYNOPSIS

ATTRIBUTES

raw

The unstructured log or event as passed to the contextualizer.

decoded

Hash of hashes built by the eris::log::decoders-decode()> step.

context

Compressed hash built by the eris::log::contexts-contextualize> step. Contexts are called in order by priority. As each context runs, it's possible to clobber the context key of a previous context. This represents the final state of the compressed namespace for the structured event.

complete

Also populated by the eris::log::contexts-contextualize> step, but uses a first level key of the context name to preserve where information orignated and protect duplicate keys.

timing

ArrayRef storing hash references representing the time each step of the contextualizer took while turning the unstructured event into a structured one.

    [
        { phase => 'context::sshd', seconds => 0.0003  },
    ]

Add new timings using the add_timings method like:

    $log->add_timing( thing => 0.212 );

tags

ArrayRef of tags to index with the doc. Add new tags with the add_tags method.

total_time

Stores the time the entire process took as a single element.

epoch

Required: The numeric representation of the time since the UNIX Epoch. Can be an integer or float. This is required to index the log in the right time.

type

Provided to override the type in the schema if being sent to Elasticsearch.

You probably shouldn't use this just set a default_type in your schema. Elastic's official docs recommend a single type per index.

uuid

Optional GUID reperesentation. If set will be passed along to Elasticsearch as the document _id, otherwise Elasticsearch will autogenerate it.

Unless you know what you're doing, you probably shouldn't set this in your contexts or schemas.

METHODS

add_context

Takes two parameters: context name as a string, a hash reference containing the context to add

Use this to add add context data in your own eris::role::context plugins:

    sub contextualize_message {
        my ($self,$log) = @_;

        $log->add_context( $self->name, { static_key => "static values are shocking" } )l
    }

add_tags

Takes a list of string tags to add to the object. Deduplicates and adds new tags to the object.

add_timing

Takes a hash of timing data to add to the timing store. This is called by the eris::log::contexts, eris::log::decoders, and eris::log::contextualizer automatically. You probably never need to call this method yourself.

as_doc

Arguments parsed from a hash:

complete

Boolean, default false. If set to true, the document is sourced for the eris::log complete event with the context namespaces as first level keys is returned. By default the eris::log context hash is returned which is a merged set of keys from all contexts.

flatten

Do we flatten the key space using Hash::Flatten. This defaults to false see the differences:

    # Default (false)
    {
        a => {
           b => 0,
           c => 1,
        }
    }

    # Flatten (true)
    {
       a.b => 0,
       a.c => 1,
    }

SEE ALSO

eris::log::contextualizer, eris::log::decoders, eris::log::contexts

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