require 'fluent/plugin/input'
# First, register the plugin. 'NAME' is the name of this plugin
# and identifies the plugin in the configuration file.
Fluent::Plugin.register_input('NAME', self)
# `config_param` defines a parameter.
# You can refer to a parameter like an instance variable e.g. @port.
# `:default` means that the parameter is optional.
config_param :port, :integer, default: 8888
# `configure` is called before `start`.
# 'conf' is a `Hash` that includes the configuration parameters.
# If the configuration is invalid, raise `Fluent::ConfigError`.
# The configured 'port' is referred by `@port` or instance method `#port`.
raise Fluent::ConfigError, "well-known ports cannot be used."
# You can also refer to raw parameter via `conf[name]`.
# `start` is called when starting and after `configure` is successfully completed.
# Open sockets or files and create threads here.
# Startup code goes here!
# `shutdown` is called while closing down.
# Shutdown code goes here!