I/O and actions reference

This section lists all built-in actions and I/O available in Mirabelle.

I/O

I/O can be referenced in streams in order to forward events to external systems.

File

This I/O write all events into a file, as edn.

{my-io-file {:config {:path "/tmp/events?edn"}
             :type :file}}

Pagerduty

This I/O forwards events to Pagerduty.

{:pagerduty-client {:config {:service-key #secret "pagerduty-service-key"
                             :source-key :service
                             :summary-keys [:host :service :state]
                             :dedup-keys [:host :service]
                             :http-options {:socket-timeout 5000
                                            :connection-timeout 5000}}
                    :type :pagerduty}}
  • The :service-key parameter is your Pagerduty service (integration) key.
  • :source-key is the event key which will be used for the alert source in the Pagerduty payload.
  • :summary-keys is a list of keys which will be used to build the event summary. In this example, the summary would be <event-host>-<event-service>-<event-state>.
  • :dedup-keys is a list of keys used to build the Pagerduty dedup key in the alert payload. :http-options is an optional map for extra HTTP options (see clj-http for more information).

The raw event will also be sent to Pagerduty in the custom_details field. The alert timestamp will be the event time, or the current time if the event has no time.

By default, the event :state is used to deduce the right Pagerduty action:

  • “critical”: trigger
  • “ok”: resolve

You can also set a :pagerduty/action key to your event in order to set the action (with the with action for example: (with :pagerduty/action :trigger ...)

InfluxDB

Forward events to the InfluxDB timserie database. This I/O forwards events to InfluxDB asynchronously.

{:influxdb {:config {:connection-string "http://127.0.0.1:8086"
                     :bucket "mirabelle"
                     :org "mirabelle"
                     :measurement :service
                     ;; either use username/password
                     :username "mirabelle"
                     :password #secret "mirabelle"
                     ;; or token authenticate
                     :token #secret "my-token"
                     :default-tags {"project" "mirabelle"}
                     :tags [:service]
                     :fields [:environment]}
            :type :influxdb}}

The :measurement, :username, :password, :token, :default-tags, :tags and fields parameters are optional. The :measurement parameter is the event key which will be used for the influxdb measurement

Default tags will be added to all events. The :tags option contains the list of keys to convert to influxdb tags, and the :fields option for fields.

You can also add the :influxdb/measurement, :influxdb/fields and :influxdb/tags to your events (using the with action for example) in order to override per event the default configuration for these options.

Elasticsearch (beta)

Forward events to ElasticSearch. This I/O forwards events to Elasticsearch asynchronously.

{:elastic {:type :elasticsearch
           :config {;; the list of elasticsearch osts
                    :hosts [{:address "localhost"
                             :port 9200}]
                    ;; the path to tls certificates (optional)
                    :key "/tmp/client-key.key"
                    :cert "/tmp/client-cert.crt"
                    :cacert "/tmp/cacert.crt"
                    ;; The http scheme (http or https)
                    :scheme "http"
                    ;; The default Elasticsearch index name
                    :default-index "abc"
                    ;; The default index pattern which will be added to the index
                    ;; name
                    :default-index-pattern "yyyy-MM-dd"
                    ;; Timeouts options (optional)
                    :connect-timeout 1000000
                    :socket-timeout 1000000
                    ;; The number of threads for the client (optional)
                    :thread-count 3
                    ;; Basic auth configuration (optional)
                    :basic-auth {:username "name"
                                 :password #secret "pass"}
                    ;; Service token (optional)
                    :service-token #secret "my-service-token"
                    ;; API key configuration (optional)
                    :api-key {:id "id"
                              :secret #secret "secret"}}}}

Actions

The generated documentation from the code contains explanations about the available actions. Here is the list:

  • above-dt
  • async-queue!
  • below-dt
  • between-dt
  • changed
  • coalesce
  • coll-bottom
  • coll-count
  • coll-max
  • coll-mean
  • coll-min
  • coll-percentiles
  • coll-quotient
  • coll-rate
  • coll-sum
  • coll-top
  • critical
  • critical-dt
  • ddt
  • ddt-pos
  • debug
  • decrement
  • disk-queue!
  • error
  • ewma-timeless
  • exception-stream
  • expired
  • fixed-event-window
  • fixed-time-window
  • from-base64
  • include
  • increment
  • index
  • info
  • io
  • json-fields
  • keep-keys
  • moving-event-window
  • not-expired
  • outside-dt
  • over
  • project
  • publish!
  • push-io!
  • reaper
  • reinject!
  • rename-keys
  • scale
  • sdissoc
  • sdo
  • sflatten
  • sformat
  • split
  • stable
  • tag
  • tagged-all
  • tap
  • test-action
  • throttle
  • to-base64
  • under
  • untag
  • warning
  • where
  • with