Skip to main content

Posts

Showing posts with the label Logstash

Logstash throws error while installing plugins

While trying to install logstash plugin, I was getting below error: $ /work/logstash/logstash-5.5.2/bin/logstash-plugin install logstash-input-cloudwatch WARNING: A maven settings file already exist at ~/.m2/settings.xml, please review the content to make sure it include your proxies configuration. Validating logstash-input-cloudwatch Installing logstash-input-cloudwatch Error Bundler::InstallError, retrying 1/10 An error occurred while installing logstash-core (5.5.2), and Bundler cannot continue. Make sure that `gem install logstash-core -v '5.5.2'` succeeds before bundling. Error Bundler::InstallError, retrying 2/10 An error occurred while installing logstash-core (5.5.2), and Bundler cannot continue. Make sure that `gem install logstash-core -v '5.5.2'` succeeds before bundling. Here are the things I did to make it work: Created maven ~/.m2/settings.xml file <?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.ap...

Setting up ELK 5.x (ElasticSearch, Logstash, Kibana) cluster

We recently upgraded from ElasticSearch 2.4.3 to 5.6.2. Below are the steps that we used to install and configure new ELK cluster. ElasticSearch Installation mkdir -p /work/elk/data/data-es562 mkdir -p /work/elk/data/logs-es562 mkdir -p /work/elk/data/repo-es562 cd /work/elk/ curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.2.tar.gz tar -zxvf elasticsearch-5.6.2.tar.gz curl -O https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-5.6.2.zip cd /work/elk/elasticsearch-5.6.2 ./bin/elasticsearch-plugin install file:///work/elk/x-pack-5.6.2.zip Configuration Settings for Master + Ingest node in elasticsearch.yml We have reused master nodes as ingest nodes, because we don't have any heavy ingest pipelines, and x-pack monitoring requires at-least one ingest node to be present in the cluster. cluster.name: ESDev562 node.name: "master_01" node.master: true # Enable the node.master role (enabled by default). node.data: false ...

A sample Logstash config to connect to ElasticSearch with TLS

Following up my previous blog post below is a sample Logstash config that can be used to connect to the ElasticSearch for the output of data: cd /work/elk/logstash-5.2.6/ vim ./config/twitter_feeds_consumer/twitter_feeds_consumer.conf input { kafka { topics => ["twitter_feeds_kafka_topic_name"] bootstrap_servers => "kafka-broker-1.domain.name:9092,kafka-broker-2.domain.name:9092" # consumer_threads => 5 # auto_offset_reset => "earliest" group_id => "logstash562_twitter_feeds_consumer_group" codec => json { charset => "ISO-8859-1" } } } output { # stdout { codec => "rubydebug" } elasticsearch { hosts => ["https://coord_01:9200"] index => "index-name-%{+YYYY.MM.dd}" ssl => true cacert => '/work/elk/logstash-5.6.2/config/ca.crt' user => logstash_internal password => logstash_internal_password } } Logs...

Logstash: Looping through nested JSON in ruby filter

Suppose we have a JSON payload (may be a stream coming from Kafka) that looks like this: {"regionName":"asia","nodes":[{"node":"router.dc1.singhaiuklimited.com","weight":"0"},{"node":"router.dc2.singhaiuklimited.com","weight":"100"}]} {"regionName":"asia","nodes":[{"node":"router.dc1.singhaiuklimited.com","weight":"0"},{"node":"router.dc1.singhaiuklimited.com","weight":"0"},{"node":"router.dc2.singhaiuklimited.com","weight":"100"},{"node":"router.dc2.singhaiuklimited.com","weight":"100"}]} To loop through the nested fields and generate extra fields from the calculations while using Logstash, we can do something like this: input { kafka { bootstrap_servers => "kafka.singhaiukl...