# Common config for file input plugins

**URL:** https://discuss.elastic.co/t/common-config-for-file-input-plugins/75190
**Category:** Logstash
**Created:** [February 15, 2017, 12:24pm UTC](https://discuss.elastic.co/t/common-config-for-file-input-plugins/75190 "2017-02-15T12:24:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Mayank\_Agrawal](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@Mayank\_Agrawal](https://discuss.elastic.co/u/Mayank_Agrawal)
#### Post date: [February 15, 2017, 12:24pm UTC](https://discuss.elastic.co/t/common-config-for-file-input-plugins/75190/1 "2017-02-15T12:24:18Z")

</div>

Hi,

Can I have common config for all the file input plugins in logstash configuration file ?

Example:

```
input{
  file {
	  type => "abc"
      path => "C:/user/logs/*abc.log*"
      sincedb_path => "C:/user/logs/abc.sincedb"	
   }

  file {
	  type => "xyz"
      path => "C:/user/logs/*xyz.log*"
      sincedb_path => "C:/user/logs/xyz.sincedb"	
   }

   codec => multiline {
       pattern => "^%{TIMESTAMP_ISO8601}"
       negate => true
       what => previous
   }

   start_position => beginning 
   ignore_older => 0 

```

Here, I want to have _codec plugin_ and settings _start-position_ , _ignore-older_ common for all the file inputs.

If above mentioned config is wrong, then can there be any other way of doing so?

---

<div class="post-metadata">

### Author: ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)
#### Post date: [February 15, 2017, 12:57pm UTC](https://discuss.elastic.co/t/common-config-for-file-input-plugins/75190/2 "2017-02-15T12:57:34Z")

</div>

This is not possible. All sections in the `input {}` are parsed independently and handed to a new instance of each plugin (file in this case) for validation. There is no way to merge a common block into a specialised block.

You could look into using something like [Mustache](https://mustache.github.io/) to "inject" your common sections into the final LS config file. The common sections could be a JSON or YAML file loaded before the Mustache file is rendered.

---

<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: [March 15, 2017, 12:57pm UTC](https://discuss.elastic.co/t/common-config-for-file-input-plugins/75190/3 "2017-03-15T12:57:50Z")

</div>

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