LoginSignup
3
1

More than 5 years have passed since last update.

マルチプルパイプラインは便利!

Posted at

logstash 6.3から簡単にパイプラインのプロセスを分けることが可能となった。

kibana6.xで提供されているモニタリングでは
logstash,elasticsearch,kibanaのリソースが確認できる。
初期状態のパイプラインは「main」のみとなっている。

image.png

これを複数のパイプラインに分けてみたい。
設定は簡単

# ls /etc/logstash/
conf.d/              log4j2.properties    logstash.yml.rpmnew  startup.options
jvm.options          logstash.yml         pipelines.yml        test.conf.d/

etc配下にある[pipelines.yml]を編集する。
初期configは下記の通り。

cat /etc/logstash/pipelines.yml
# This file is where you define your pipelines. You can define multiple.
# For more information on multiple pipelines, see the documentation:
#   https://www.elastic.co/guide/en/logstash/current/multiple-pipelines.html

- pipeline.id: main
  path.config: "/etc/logstash/conf.d/*.conf"

モニタリングで確認できるmainという名前のパイプラインのコンフィグファイルがあるディレクトリが記載されている。
新しいパイプラインを追加するには同じように追加すればよい。
今回は[test]を追加してみる。

cat /etc/logstash/pipelines.yml
# This file is where you define your pipelines. You can define multiple.
# For more information on multiple pipelines, see the documentation:
#   https://www.elastic.co/guide/en/logstash/current/multiple-pipelines.html

- pipeline.id: main
  path.config: "/etc/logstash/conf.d/*.conf"
  pipeline.workers: 1
- pipeline.id: test
  path.config: "/etc/logstash/test.conf.d/*.conf"
  pipeline.workers: 1

新しくコンフィグを格納するディレクトリを作成し、
その配下を指定した[test]パイプラインを作成した。
また。「pipeline.workers: 1」は利用するCPU?コア?を指定できるらしい。

logstashを起動した際にこの「pipelines.yml」から読み込ませる必要がある。
初期設定では

cat /etc/logstash/logstash.yml
~
# ------------ Pipeline Configuration Settings --------------
#
# Where to fetch the pipeline configuration for the main pipeline
#
path.config: /etc/logstash/conf.d ★ここ
#

mainに設定されているディレクトリが指定されている。
pipeline.ymlの設定を読み込ませるには★ここをコメントアウトすればよい。

あとは
systemctl restart logstash

そうするとモニタリングで下記の通り表示される。
image.png

管理がしやすい
パイプラインごとにリスタート、停止などの操作が可能なはずなため大変便利であるのは間違いない。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1