Reader small image

You're reading from  Mastering Elastic Stack

Product typeBook
Published inFeb 2017
PublisherPackt
ISBN-139781786460011
Edition1st Edition
Right arrow
Authors (2):
Ravi Kumar Gupta
Ravi Kumar Gupta
author image
Ravi Kumar Gupta

Ravi Kumar Gupta is an author, reviewer, and open source software evangelist. He pursued an MS degree in software system at BITS Pilani and a B.Tech at LNMIIT, Jaipur. His technological forte is portal management and development. He is currently working with Azilen Technologies, where he acts as a Technical Architect and Project Manager. His previous assignment was as a lead consultant with CIGNEX Datamatics. He was a core member of the open source group at TCS, where he started working on Liferay and other UI technologies. During his career, he has been involved in building enterprise solutions using the latest technologies with rich user interfaces and open source tools. He loves to spend time writing, learning, and discussing new technologies. His interest in search engines and that small project on crawler during college time made him a technology lover. He is one of the authors of Test-Driven JavaScript Development, Packt Publishing. He is an active member of the Liferay forum. He also writes technical articles for his blog at TechD of Computer World (http://techdc.blogspot.in). He has been a Liferay trainer at TCS and CIGNEX, where he has provided training on Liferay 5.x and 6.x versions. He was also a reviewer for Learning Bootstrap, Packt Publishing. He can be reached on Skype at kravigupta, on Twitter at @kravigupta, and on LinkedIn at https://in.linkedin.com/in/kravigupta.
Read more about Ravi Kumar Gupta

Yuvraj Gupta
Yuvraj Gupta
author image
Yuvraj Gupta

Yuvraj Gupta is an author and a keen technologist with interest towards Big Data, Data Analytics, Data Visualization, and Cloud Computing. He has been working as a Big Data Consultant primarily in domain of Big Data Testing. He loves to spend time writing on various social platforms. He is an avid gadget lover, a foodie, a sports enthusiast and love to watch tv-series or movies. He always keep himself updated with the latest happenings in technology. He has authored a book titled Kibana Essentials with Packt Publishers. He can be reached at gupta.yuvraj@gmail.com or at LinkedIn www.linkedin.com/in/guptayuvraj.
Read more about Yuvraj Gupta

View More author details
Right arrow

Chapter 7. Customizing Elastic Stack

One point to check whether a tool is great, is to find the answer of the following question: how much can it be customized? If you are selling your product, and if you have answer to that question like - Yes, and these are the ways. You already sold the product. This is an era of open source products, and level of customization of the product, plays a major role in deciding whether a product should be utilized for our requirement or not. There are many things your buyer would want to do with your setup, such as writing custom plugins, modifying existing things in product, modifying the UI for your branding, and much more.

In this chapter, we will learn how to customize the Elastic Stack by extending or modifying the components. The following is a list of topics that we will capture in this chapter:

  • Extending Elasticsearch

  • Extending Logstash

  • Extending Beats

  • Extending Kibana

Extending Elasticsearch


Elasticsearch is a rich-in-feature, stable, and mature project, yet it is growing everyday. Like a good open source project, Elasticsearch offers ways to extend and let users customize Elasticsearch in their own ways. There are many things you would want to achieve through customization, to name a few: you would want to support a new repository to which Elasticsearch can connect and keep data, you might be interested to write your own analyzer, which does some additional tasks as compared to the existing analyzers in Elasticsearch, and so on. For the previous versions of Elasticsearch (prior to v5), developers used to create their own rivers to support a new data source. In fact, using the HTTP and transport modules, there are numerous opportunities of extending Elasticsearch beyond Elasticsearch packaged code and providing something that helps to integrate Elasticsearch with some other tool or technology.

Although not too many attempts were made to customize Elasticsearch...

Extending Logstash


There are two ways to extend Logstash: either by modifying the core or adding one more plugin to its repository. As we have already learned, there are four types of plugins - Input, Output, Filter, and Codec. Generating plugin in Logstash is very easy and needs only one command to be run; the generated plugin needs only our custom logic for it to be implemented.

Logstash plugins are written in Ruby programming language (http://www.ruby-lang.org/en/). These plugins are actually ruby gems. To be able to write effective gems, you should be familiar with Ruby.

In this section, we will develop our own input plugin, which will fetch data from a web service. The complete code of the plugin is available at GitHub at https://github.com/kravigupta/mastering-elastic-stack-code-files/tree/5.1.1/Chapter07/logstash-input-weather. The purpose of this exercise is to learn how a plugin can be generated and customized to serve the purpose, along with understanding of structure of the plugin...

Extending Beats


As we learned through previous chapters, there are four core Beats provided by Elastic Team: Filebeat, Packetbeat, Metricbeat, and Winlogbeat. There is a huge list of community Beats as well available at https://www.elastic.co/guide/en/beats/libbeat/5.1/community-beats.html.

All of these are built on top of the libbeat framework. In case you don't find a beat that meets your expectations and you want to create a new one, your new beat will also follow the same framework. This framework is designed in such a way that all you need to take care is your custom logic, which will fetch the data from a source and prepare an event to be sent to either Elasticsearch or Logstash.

In this section, we will see how to create a beat by utilizing the libbeat framework. Beats were created to minimize the usage of Logstash. We will also use the same use case used for Logstash plugin. We will read the data from a web service and index the data to Elasticsearch. For reference, all of the generated...

Extending Kibana


When you set up Elastic Stack for your environment, you sense the needed changes in the stack to fulfill your requirements. For most of the cases, changes done at Elasticsearch are minimum as compared to rest of the components. Kibana being the face of the stack undergoes maximum changes. If nothing complex, your client (in case you are a service provider) would like to customize the UI to match their company's website look.

There are ways in which Kibana can be customized and extended-we can write Kibana plugins, create new visualizations, modify the source, and so on. To do any of these, you must be familiar with HTML, CSS, Javascript, Node.js, AngularJS, and probably relevant library to be used for charts and visualizations. Kibana is basically a Node.js app, thus knowing Node.js will help greatly to understand and customize Kibana.

In this section, we will develop a plugin that changes the appearance of the Kibana UI. For our use case, we will keep it simple and modify...

Summary


If we talk about customization of four tools, it would take four different chapters to begin with. However, we tried to understand the ways a tool can be extended. In this chapter, we learned about extending Elasticsearch by learning how a plugin is organized and popular ways to customize.

Later in the chapter, we created a Logstash plugin, which captured data from the Openweathermap.org server and sent it to Elasticsearch. We also learned about creating a new beat with example of collecting data from the same web service. Finally, we set up the Kibana development environment and learned to create a very basic hack of changing the title of the Kibana pages by appending PACKT to it.

In the next chapter, we will be revisiting Elasticsearch and its APIs. We will learn how to access the APIs and how they are useful to us. The chapter will also introduce ingest nodes which is a new addition to Elasticsearch v5.x onwards.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering Elastic Stack
Published in: Feb 2017Publisher: PacktISBN-13: 9781786460011
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Ravi Kumar Gupta

Ravi Kumar Gupta is an author, reviewer, and open source software evangelist. He pursued an MS degree in software system at BITS Pilani and a B.Tech at LNMIIT, Jaipur. His technological forte is portal management and development. He is currently working with Azilen Technologies, where he acts as a Technical Architect and Project Manager. His previous assignment was as a lead consultant with CIGNEX Datamatics. He was a core member of the open source group at TCS, where he started working on Liferay and other UI technologies. During his career, he has been involved in building enterprise solutions using the latest technologies with rich user interfaces and open source tools. He loves to spend time writing, learning, and discussing new technologies. His interest in search engines and that small project on crawler during college time made him a technology lover. He is one of the authors of Test-Driven JavaScript Development, Packt Publishing. He is an active member of the Liferay forum. He also writes technical articles for his blog at TechD of Computer World (http://techdc.blogspot.in). He has been a Liferay trainer at TCS and CIGNEX, where he has provided training on Liferay 5.x and 6.x versions. He was also a reviewer for Learning Bootstrap, Packt Publishing. He can be reached on Skype at kravigupta, on Twitter at @kravigupta, and on LinkedIn at https://in.linkedin.com/in/kravigupta.
Read more about Ravi Kumar Gupta

author image
Yuvraj Gupta

Yuvraj Gupta is an author and a keen technologist with interest towards Big Data, Data Analytics, Data Visualization, and Cloud Computing. He has been working as a Big Data Consultant primarily in domain of Big Data Testing. He loves to spend time writing on various social platforms. He is an avid gadget lover, a foodie, a sports enthusiast and love to watch tv-series or movies. He always keep himself updated with the latest happenings in technology. He has authored a book titled Kibana Essentials with Packt Publishers. He can be reached at gupta.yuvraj@gmail.com or at LinkedIn www.linkedin.com/in/guptayuvraj.
Read more about Yuvraj Gupta