# How we can create custom filter plugin in logstash?

**URL:** <https://discuss.elastic.co/t/how-we-can-create-custom-filter-plugin-in-logstash/113571>\
**Category:** Logstash\
**Created:** [December 29, 2017, 11:02am UTC](https://discuss.elastic.co/t/how-we-can-create-custom-filter-plugin-in-logstash/113571 "2017-12-29T11:02:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yash\_mangla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yash_mangla/32/25889_2.png) [@yash\_mangla](https://discuss.elastic.co/u/yash_mangla)\
**Post date:** [December 29, 2017, 11:02am UTC](https://discuss.elastic.co/t/how-we-can-create-custom-filter-plugin-in-logstash/113571/1 "2017-12-29T11:02:13Z")

</div>

Hello Folks,

I am using logstash 5.6.3 and I have written python script for parsing the some part of logs. i want to call this script from filter section of logstash.

I look around almost all the ways to look into it. i found a basic template structure to create plugin in logstash.

[https://www.elastic.co/guide/en/logstash/current/plugin-generator.html](https://www.elastic.co/guide/en/logstash/current/plugin-generator.html)

but it will create directory structure only for plugins. I am facing challenge to install dependency regarding this.

So i have following questions:

1. how we can define the dependency in plugins and where i have to register those dependency entry ?
2. how we can test this with logstash base functionality ?
3. how to build final gem file to install this plugin into logstash ?

I will appreciate if someone can share some sample in this scenario.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [December 31, 2017, 1:27pm UTC](https://discuss.elastic.co/t/how-we-can-create-custom-filter-plugin-in-logstash/113571/2 "2017-12-31T13:27:25Z")

</div>

I think you'll answers to most of your questions in [https://www.elastic.co/guide/en/logstash/current/\_how\_to\_write\_a\_logstash\_filter\_plugin.html](https://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_filter_plugin.html).

1. The .gemspec file lists dependencies.
2. Write specs for the plugin? Or install the plugin and try it out? I'm not sure I understand the question.
3. `gem build logstash-filter-whatever.gemspec`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 28, 2018, 1:27pm UTC](https://discuss.elastic.co/t/how-we-can-create-custom-filter-plugin-in-logstash/113571/3 "2018-01-28T13:27:32Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
