hanshasselberg / consul-raftdb-reader

A CLI tool to read Consul's RAFT commitlog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consul RAFT database reader

This is a small tool to read Consul's commit log from the RAFT database and output the events in json format.

Installing and building

go get -u github.com/outbrain/consul-raftdb-reader

Using

Copy the raft/raft.db file from a Consul server - the Consul server process must be turned off before copying because the file is continuosly mutated. After copying, open the file with this tool:

consul-raftdb-reader raft.db > raft.events

Indexing with ELK

A common use case is analyzing the dump with ELK. You can use the included ElasticSearch index template to get ElasticSearch to index the fields properly.

curl -XPUT http://localhost:9200/_template/consul_raft -d @raft.es.template.es

After the index template has been loaded, index the dump to ElasticSearch with Logstash:

consul-raftdb-reader raft.db | logstash agent -e 'input { stdin { codec => json_lines } } output { elasticsearch { index => "consul_raft" document_type => "raft_txn" hosts => ["localhost:9200"] } }'

Now you can analyze the dump in Kibana.

About

A CLI tool to read Consul's RAFT commitlog

License:Apache License 2.0


Languages

Language:Go 100.0%