LoginSignup
1
1

More than 5 years have passed since last update.

logstashの設定:fileプラグインのpathはStringではなくArrayで

Posted at

logstashのfileプラグインのpathの指定ではまりました。 確かにTypeはArrayとは書いてあるが、
ドキュメントには文字列でも大丈夫と読み取れる(私は読み取ってしまった)サンプルコードがの記述がある。
指定ディレクトリが一つだけだったので、サンプルコードのやり方を参考に文字列で記述した。

Logstash

  • version 2.1.3

公式ドキュメント

公式ドキュメントから引用しています。
このサンプルコードを見て文字列で記述してしまうの普通ではない???

Structrue of a Config File

Plugin Configuration

The configuration of a plugin consists of the plugin name followed by a block of settings for that
plugin. For example, this input section configures two file inputs:

input {
  file {
    path => "/var/log/messages"
    type => "syslog"
  }

  file {
    path => "/var/log/apache/access.log"
    type => "apache"
  }
}

(省略)

Value Types

A plugin can require that the value for a setting be a certain type, such as boolean or hash. The
following value types are supported.

Array

An array can be a single string value or multiplvalues. If you specify the same setting multiple
times, it appends to the array.

Example:

  path => [ "/var/log/messages", "/var/log/*.log" ]
  path => "/data/mysql/mysql.log"

学んだこと

  • 公式ドキュメントも注意深く見ることが重要
  • 可能性が2つあるならどちらも試す
1
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
1
1