# Logstashのmultiple pipelineでの、同一input

**URL:** <https://discuss.elastic.co/t/logstash-multiple-pipeline-input/149932>\
**Category:** 日本語による質問・議論はこちら\
**Created:** [September 26, 2018, 6:10am UTC](https://discuss.elastic.co/t/logstash-multiple-pipeline-input/149932 "2018-09-26T06:10:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hogehuga](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@hogehuga](https://discuss.elastic.co/u/hogehuga)\
**Post date:** [September 26, 2018, 6:10am UTC](https://discuss.elastic.co/t/logstash-multiple-pipeline-input/149932/1 "2018-09-26T06:10:00Z")

</div>

Logstashでmultiple pipelineを利用したいと考えています。

通常はisolateするためにinputは異なるようにするものだと思っていますが、同一inputの場合はパフォーマンス等で有意になることは有るのでしょうか。

- 本来は、例えばsyslog転送やrsyncでファイルとして回収した上で、inputをファイルとして取り込むのが一番良さそうだと思ってはいます。
- 各サーバにfilebeatを配置し、logtypeで種類分けをして Logstash:5044へ送る、という設定をすると、logstash5044がパフォーマンス不足になり「multiple pipelineを使え」的なエラーが出たので検討しています。

* * *

例えば、以下のような状況を想定しています。

- 2種類のpipelineがある
- 今まではsingle pipelineでif httpd - else if ftpd のように、if文で分岐して処理していた
- worker等のパフォーマンスが足りなくなるくらいの量が来ている
- 下記のように2つの設定をmultiple pipelineで稼働させると、個別にworker等の設定ができるので、パフォーマンスは少しあげられる？(inputが違えば、パフォーマンスあげられそうな気はしますが…)

元のlogstash.yml

```auto
input {
  beats {
    port => "5044"
  }
}
filter{
  if [fields][logtype] == "httpd" {
    grok {
      <<処理を記載>>
    }
  } else if [fields][logtype] == "fptd" {
    grok {
      <<処理を記載>>
    }
  }
}
output{
  if [fields][logtype] == "httpd" {
    elasticsearch{
      hosts => ["localhost:9200"]
      index => "httdAccess-%{+YYYYMMdd}"
  } else if [fields][logtype] == "ftpd" {
    elasticsearch{
      hosts => ["localhost:9200"]
      index => "ftpAccess-%{+YYYYMMdd}"
  }
}

```

multiple pipeline化したconfig  
conf.d/httpd.yml

```auto
input {
  beats {
    port => "5044"
  }
}
filter{
  if [fields][logtype] == "httpd" {
    grok {
      <<処理を記載>>
    }
  }
}
output{
  elasticsearch{
    hosts => ["localhost:9200"]
    index => "httdAccess-%{+YYYYMMdd}"
}

```

conf.d/ftpd.yml

```auto
input {
  beats {
    port => "5044"
  }
}
filter{
  if [fields][logtype] == "ftpd" {
    grok {
      <<処理を記載>>
    }
  }
}
output{
  elasticsearch{
    hosts => ["localhost:9200"]
    index => "ftpdAccess-%{+YYYYMMdd}"
}

```

上記設定で起動すると、5044へ logtype: ftpd/httpd どちらを投げても処理してくれます。

- inputは共通で使われている？
- 両方のfilterを通っていると思われ、if分岐の場合と比べて 2倍の負荷になっている？

---

<div class="post-metadata">

**Author:** ![r4-keisuke](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/r4-keisuke/32/9268_2.png) [@r4-keisuke](https://discuss.elastic.co/u/r4-keisuke)\
**Post date:** [September 26, 2018, 8:16am UTC](https://discuss.elastic.co/t/logstash-multiple-pipeline-input/149932/2 "2018-09-26T08:16:55Z")

</div>

こんにちはー  
実際試してないのでなんともですが、  
pipeline to pipelineだと思うので以下のような内容の設定になるんじゃないかなと思いますね  
[https://www.elastic.co/guide/en/logstash/current/pipeline-to-pipeline.html](https://www.elastic.co/guide/en/logstash/current/pipeline-to-pipeline.html)

inputは最初受け取るpipelineが使って、定義によるoutputに他のpipelineのinputから拾うイメージです。

---

<div class="post-metadata">

**Author:** ![hogehuga](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@hogehuga](https://discuss.elastic.co/u/hogehuga)\
**Post date:** [September 26, 2018, 8:44am UTC](https://discuss.elastic.co/t/logstash-multiple-pipeline-input/149932/3 "2018-09-26T08:44:25Z")

</div>

ありがとうございます！  
内容的にはpipeline-to-pipelineですね。  
これで設定すれば十分意味がありそうです。

ただ、現時点ではbetaなので、本番利用は避けたほうが良さそうでした。

ありがとうございました。

---

<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:** [October 24, 2018, 8:44am UTC](https://discuss.elastic.co/t/logstash-multiple-pipeline-input/149932/4 "2018-10-24T08:44:31Z")

</div>

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