Structure of a Logstash plugin
As already mentioned in Logstash plugin management, Logstash plugins are self-contained RubyGems.
Note
This section requires a little bit knowledge of the Ruby programming language. If you are looking for a quick overview, you can look at the official Ruby tutorial here:
As extensive knowledge of Ruby is not expected from the readers, we will take a look at some simple illustrations of how a plugin works, and how we can design one simple plugin on our own. We will also cover some details of how the plugins are bundled to gems. More information is available at https://www.elastic.co/guide/en/logstash/current/contributing-to-logstash.html.
Let's look at the structure of a drop filter
plugin, which is used to drop certain events on certain conditions (https://github.com/logstash-plugins/logstash-filter-drop):
# encoding: utf-8 require "logstash/filters/base" require "logstash/namespace"...