Help us understand the problem. What is going on with this article?

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

More than 3 years have passed since last update.

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つあるならどちらも試す
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした