In order to use the library add the dependency to your project.clj
;; Leiningen project
[com.brunobonacci/mulog-elasticsearch "x.x.x"]
;; deps.edn format
{:deps { com.brunobonacci/mulog-elasticsearch {:mvn/version "x.x.x"}}}
The events must be serializeable in JSON format (Cheshire)
The available configuration options:
{:type :elasticsearch
;; Elasticsearch endpoint (REQUIRED)
:url "http://localhost:9200/"
;; The Elasticsearch version family.
;; one of: `:auto` `:v6.x` `:v7.x`
:els-version :auto
;; the maximum number of events which can be sent in a single
;; batch request to Elasticsearch
:max-items 5000
;; Interval in milliseconds between publish requests.
;; μ/log will try to send the records to Elasticsearch
;; with the interval specified.
:publish-delay 5000
;; The index pattern to use for the events
:index-pattern "'mulog-'yyyy.MM.dd"
;; Whether or not to change the attribute names
;; to facilitate queries and avoid type clashing
;; See more on that in the link below.
:name-mangling true
;; a function to apply to the sequence of events before publishing.
;; This transformation function can be used to filter, tranform,
;; anonymise events before they are published to a external system.
;; by defatult there is no transformation. (since v0.1.8)
:transform identity
}
How to use it:
(μ/start-publisher!
{:type :elasticsearch
:url "http://localhost:9200/"})
Supported versions: 6.7+
, 7.x
Read more on Elasticsearch name mangling here.