vibed-elastic-logger 1.0.0

Vibe.d logger implementation for ElasticSearch


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

vibed-elastic-logger CI status

ElasticSearch logger implementation for Vibe.d

Documentation

Available online here.

Example

void main()
{
    import vibe.core.log : logInfo, registerLogger;
    import vibe_elastic_logger : ElasticInfo, ElasticLogger;
    import core.time : dur;

    string generateIndex() @safe
    {
        import std.datetime : Clock;
        import std.format : format;

        auto now = Clock.currTime();
        return format!"vibe_logger_test_%04d_%02d"(now.year, now.month);
    }

    ElasticInfo info;
    info.hostName = "localhost";
    info.typeName = "messages";
    info.portNumber = 9200;
    auto l = cast(shared) new ElasticLogger(info, &generateIndex, dur!"seconds"(5), 30);
    registerLogger(l);
}

Data Format

Here's an example of what a log message will look like in Elastic:

...
      {
        "_index": "vibe_logger_test_2018_02",
        "_type": "messages",
        "_id": "AWFtxExgJY-mBsy0A_50",
        "_score": 1,
        "_source": {
          "message": "Main thread exiting",
          "module": "",
          "function": "",
          "file": "../../.dub/packages/vibe-d-0.8.2/vibe-d/core/vibe/core/core.d",
          "line": "1781",
          "level": "diagnostic",
          "fiberID": "0",
          "time": "2018-02-07T00:57:16.6429738Z"
        }
      },
...
Authors:
  • Emsi
Sub packages:
vibed-elastic-logger:test
Dependencies:
vibe-d
Versions:
1.0.0 2018-Feb-08
~master 2018-Feb-08
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 5 downloads total

Score:
0.2
Short URL:
vibed-elastic-logger.dub.pm