[[contributing-to-logstash]]
== Contributing to Logstash

You can add your own input, codec, filter, or output plugins to Logstash. 

include::contrib-acceptance.asciidoc[]

[discrete]
[[add-plugin]]
=== Add a plugin

Plugins can be developed and deployed independently of the Logstash core. 
Here are some documents to guide you through the process of coding, deploying, and sharing your plugin:

* Write a new plugin 
** <<input-new-plugin>>
** <<codec-new-plugin>>
** <<filter-new-plugin>>
** <<output-new-plugin>>
** <<community-maintainer,Community Maintainer's Guide>>
* <<plugin-doc>>
* <<publish-plugin>>
* <<plugin-listing>>

* Contribute a patch
** <<contributing-patch-plugin>>
** <<contribute-to-core>>

[discrete]
[[shutdown-apis]]
===== Plugin Shutdown APIs

You have three options for shutting down a plugin: `stop`, `stop?`, and `close`.

* Call the `stop` method from outside the plugin thread. This method signals the plugin to stop.
* The `stop?` method returns `true` when the `stop` method has already been called for that plugin.
* The `close` method performs final bookkeeping and cleanup after the plugin's `run` method and the plugin's thread both
exit. The `close` method is a a new name for the method known as `teardown` in previous versions of Logstash.

The `shutdown`, `finished`, `finished?`, `running?`, and `terminating?` methods are redundant and no longer present in the
Plugin Base class.

Sample code for the plugin shutdown APIs is https://github.com/logstash-plugins/logstash-input-example/blob/main/lib/logstash/inputs/example.rb[available].

