All Projects → lukemonahan → splunk_modinput_prometheus

lukemonahan / splunk_modinput_prometheus

Licence: Apache-2.0 license
A Splunk modular input for ingesting Prometheus metrics

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to splunk modinput prometheus

TA-opnsense
Splunk Add on for OPNsense firewall
Stars: ✭ 13 (-67.5%)
Mutual labels:  splunk
ansible-splunk-playbook
Install a full Splunk Enterprise Cluster or Universal forwarder using an ansible playbook
Stars: ✭ 34 (-15%)
Mutual labels:  splunk
TA-Sysmon-deploy
Deploy and maintain Symon through the Splunk Deployment Sever
Stars: ✭ 31 (-22.5%)
Mutual labels:  splunk
spring-microservices-in-action
The source code of the book "Spring Microservices in Action (John Carnell)" and the personal summary of technical essentials about Spring Boot for microservices.
Stars: ✭ 54 (+35%)
Mutual labels:  splunk
vagrant-ids
An Ubuntu 16.04 build containing Suricata, PulledPork, Bro, and Splunk
Stars: ✭ 21 (-47.5%)
Mutual labels:  splunk
splunk handler
Python logging handler for sending logs to Splunk Enterprise
Stars: ✭ 44 (+10%)
Mutual labels:  splunk
maple
Type-safe, consistently named and formatted, structured logging wrapper for SLF4J that's ideally suited for your logging aggregator.
Stars: ✭ 39 (-2.5%)
Mutual labels:  splunk
evtx2json
A tool to convert Windows evtx files (Windows Event Log Files) into JSON format and log to Splunk (optional) using HTTP Event Collector.
Stars: ✭ 38 (-5%)
Mutual labels:  splunk
splunk-otel-js-web
Splunk distribution of Open Telemetry for browser environment.
Stars: ✭ 23 (-42.5%)
Mutual labels:  splunk
fanuc-driver
Configurable Fanuc Focas data collector and post processor.
Stars: ✭ 38 (-5%)
Mutual labels:  splunk
config explorer
Config viewer and file editor for Splunk. Based on VSCode.
Stars: ✭ 20 (-50%)
Mutual labels:  splunk
Kong-API-Manager
Kong API Manager with Prometheus And Graylog
Stars: ✭ 78 (+95%)
Mutual labels:  splunk
Sigma
Generic Signature Format for SIEM Systems
Stars: ✭ 4,418 (+10945%)
Mutual labels:  splunk
sysmon-splunk-app
Sysmon Splunk App
Stars: ✭ 42 (+5%)
Mutual labels:  splunk
splunk-connect-for-syslog
Splunk Connect for Syslog
Stars: ✭ 111 (+177.5%)
Mutual labels:  splunk
detection-rules
Threat Detection & Anomaly Detection rules for popular open-source components
Stars: ✭ 34 (-15%)
Mutual labels:  splunk
ansible-role-for-splunk
Splunk@Splunk's Ansible role for installing Splunk, upgrading Splunk, and installing apps/addons on Splunk deployments (VM/bare metal)
Stars: ✭ 75 (+87.5%)
Mutual labels:  splunk
TA-dmarc
Add-on for ingesting DMARC aggregate reports into Splunk
Stars: ✭ 14 (-65%)
Mutual labels:  splunk
TA ETW
Splunk Technology Add-On (TA) for collecting ETW events from Windows systems
Stars: ✭ 17 (-57.5%)
Mutual labels:  splunk
TA-bigfix
Splunk technical add-on (TA) for ingesting BigFix client, relay, and server logs. Includes REST inputs for ingesting assets, relevant fixlets, action summaries, and analysis results.
Stars: ✭ 15 (-62.5%)
Mutual labels:  splunk

Prometheus Metrics for Splunk

Prometheus prometheus.io, a Cloud Native Computing Foundation project, is a systems and service monitoring system. It collects metrics from configured targets at given intervals, evaluates rule expressions, displays the results, and can trigger alerts if some condition is observed to be true.

Splunk splunk.com is a platform for machine data analysis, providing real-time visibility, actionable insights and intelligence across all forms of machine data. Splunk Enterprise since version 7.0 includes the Metrics store for large-scale capture and analysis of time-series metrics alongside log data.

This Splunk add-on provides two modular inputs to ingest Splunk metrics from Prometheus:

[prometheus://]

A scraping input which polls a Prometheus exporter and indexes all exposed metrics in Splunk.

It is also designed to be able to poll a Prometheus servers "/federate" endpoint, so that Prometheus can be responsible for all the metrics gathering details (e.g. service discovery and label rewriting) and Splunk can easily ingest a desired subset of metrics from Prometheus at the desired resolution. In this way it acts much like Prometheus hierarchical federation.

It will also successfully scrape a statically configured Prometheus exporter, and for this use case does not require a Prometheus server at all.

[prometheusrw://]

A bridge so that the Prometheus remote-write feature can continuously push metrics to a Splunk Enterprise system. When installed and enabled, this input will add a new listening port to your Splunk server which can be the remote write target for multiple Prometheus servers.

It has been designed to mimic the Splunk HTTP Event Collector for it's configuration, however the endpoint is much simpler as it only supports Prometheus remote-write. The HEC is not used for this as Prometheus remote-write requires Speedy compression and Protocol Buffer encoding, both of which do not work with the HEC.

Requirements

  • Splunk 8.x and above
  • Prometheus 2.x
  • Recent Linux x64

The most testing has been performed on Splunk 8.2 and Prometheus 2.36 on Ubuntu 20.04

Architecture overview

Static exporter

In this configuration, the modular input can poll any statically configured Prometheus exporter at a defined interval.

Pros:

  • Simple
  • Requires no Prometheus server

Cons:

  • Static configuration only -- very manual to add lots of systems
  • HA of Splunk polling is difficult

Federate server

With this configuration, the modular input is setup to poll a Prometheus server that is exposing the metrics from exporters and other Prometheus servers on it's federate endpoint.

Pros:

  • Allows Prometheus to handle service discovery and other low-level functions
  • High level of control of what Splunk gathers and when using polling interval and match vectors
  • Allows scenarios such as using Prometheus to gather high-resolution metrics, and ingesting into Splunk at reduced frequency

Cons:

  • HA of Splunk polling is difficult
  • Could run into scalability issues if you want to gather large numbers of metrics from a single Prometheus server at a high rate

Prometheus remote-write

With this configuration, Prometheus pushes metrics to Splunk with it's remote_write functionality.

Pros:

  • Most efficient way to ingest all, or nearly all, metrics from a Prometheus server into Splunk
  • HA and scaling of Splunk ingestion is achievable with HTTP load balancers

Cons:

  • Must send metrics to Splunk with same frequency as they are gathered into Prometheus

Hybrid

All metrics gathered by the above methods are in a consistent format in Splunk, and reporting over them will be no different no matter how they are gathered. Because of this, different ways of delivering metrics for different use cases could be implemented.

Download

This add-on will be hosted at apps.splunk.com in the near future. It will be uploaded there when some further testing has been completed.

In the meantime, the latest build is available in the Github releases tab.

Build

This assumes you have a relatively up-to-date Go build environment set up.

You will need some dependencies installed:

$ go get github.com/gogo/protobuf/proto
$ go get github.com/golang/snappy
$ go get github.com/prometheus/common/model
$ go get github.com/prometheus/prometheus/prompb
$ go get github.com/gobwas/glob
$ go get github.com/prometheus/prometheus/model/textparse

The "build" make target will build the modular input binaries, and copy them into the correct place in modinput_prometheus, which forms the root of the Splunk app.

$ make build

Install and configure

This add-on is installed just like any Splunk app: either through the web UI, deployment server or copying directly to $SPLUNK_HOME/etc/apps.

We recommend installing on a heavy forwarder, so the processing of events into metrics occurs at the collection point and not on indexers. The app is only tested on a heavy instance so far, but if you use a Universal Forwarder be sure to also install on your HFs/Indexers as there are index-time transforms to process the received metrics.

All available parameters for the modular inputs are described in inputs.conf.spec.

Static exporter

The most basic configuration to poll a Prometheus exporter.

e.g.

[prometheus://java-client-1]
URI = http://myhost:1234/metrics
index = prometheus
sourcetype = prometheus:metric
host = myhost
interval = 60
disabled = 0

The index should be a "metrics" type index. The sourcetype should be prometheus:metric, which is configured in the app to recognize the data format and convert it to Splunk metrics.

Federate server

This configuration is to gather all metrics from a Prometheus server. At least one valid "match" must be supplied in order to get any data from a Prometheus federation endpoint. Eatch "match" is entered with semicolon separation in the Splunk configuration. The example "match" string given here matches all metrics. You can learn more about how to configure metrics matching at: https://prometheus.io/docs/prometheus/latest/querying/basics/#instant-vector-selectors

[prometheus://prom-server-1]
URI = http://myhost:9090/federate
match = {__name__=~"..*"}
index = prometheus
sourcetype = prometheus:metric
host = myhost
interval = 60
disabled = 0

Prometheus remote-write

Only one HTTP server is ever run, which is configured by the [prometheusrw] input stanza. The individual inputs are then distinguished by bearer tokens. At least one of the individual inputs must be configured, and a matching bearer token must be supplied from Prometheus in order to direct the received metrics to that input.

e.g.

[prometheusrw]
port = 8098
maxClients = 10
disabled = 0

[prometheusrw://testing]
bearerToken = ABC123
index = prometheus
whitelist = *
sourcetype = prometheus:metric
disabled = 0

[prometheusrw://another]
bearerToken = DEF456
index = another_metrics_index
whitelist = net*
sourcetype = prometheus:metric
disabled = 0

[prometheusrw://parsed]
bearerToken = PAR042
index = another_metrics_index
whitelist = *
sourcetype = prometheus:metric
metricNamePrefix = DEV.
metricNameParse = true
disabled = 0

This starts the HTTP listener on port 8098, and any metrics coming in with a bearer token of "ABC123" will be directed to the "testing" input, wheras any received with a bearer token of "DEF456" will be directed to the "another" input. Not including a bearer token, or a non-matching token, will result in a HTTP 401 (Unauthorized).

At least one whitelist should be supplied, and a blacklist is also available. Whitelist and blacklist are comma-separated globs that match against an incoming metric name.

Although the input does allow some basic whitelist and blacklist behaviour against the metric name before ingesting in Splunk, it will be more efficient and flexible to do this on the Prometheus server using write_relabel_configs if that is possible. An example of dropping metrics withis way is shown in the configuration below.

In your Prometheus runtime YML file, ensure the following is set to start sending metrics to the prometheusrw Splunk input:

  remote_write:
    - url: "http://<hostname>:8098"
      bearer_token: "ABC123"
      write_relabel_configs:
        - source_labels: [__name__]
          regex:         expensive.*
          action:        drop

Full details of available Prometheus options are at: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#%3Cremote_write%3E

Known Limitations

  • Only Linux on x86_64 is tested for now.
  • Validation of configuration is not very advanced -- incorrect configuration will not work with little indication as to why.
  • Only some basic HTTP options are supported, which should be fine for basic Prometheus endpoints but may not work with various proxying methods etc.
  • No user interface for configuring inputs at this stage, you'll have to do it all via inputs.conf.
  • This add-on does not make much sense to run in Splunk Cloud, so no compatibility there. You should run this on a local Heavy Forwarder and forward the generated metrics to Splunk Cloud.

Binary File Declaration

All binaries built from source code at: https://github.com/lukemonahan/splunk_modinput_prometheus

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].