如何在 logstash 中加载 CSV 文件
How to load CSV file in logstash
我正在尝试在 logstash 中加载 CSV 文件,但它没有读取文件,也没有在 elasticsearch 中创建索引
我需要在 elasticsearch 中读取 CSV 文件。
尝试对配置文件进行一些更改。
我的配置文件
input {
file {
type => "csv"
path => "/root/installables/*.csv"
start_position => beginning
}
}
filter {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
}
output {
elasticsearch {
hosts => localhost
index => "client"
}
}
谁能告诉我如何在 logstash 中加载 CSV 文件?
我认为你应该放一个 "csv" 过滤器。我让它像这样工作:
input {
file {
path => "/filepath..."
start_position => beginning
# to read from the beginning of file
sincedb_path => "/dev/null"
}
}
filter {
csv {
columns => ["COL1", "COL2"]
}
}
output {
stdout { codec => rubydebug }
elasticsearch {
host => "localhost"
index => "csv_index"
}
}
此外,添加标准输出作为输出有助于调试并了解文件是否正在加载
我正在尝试在 logstash 中加载 CSV 文件,但它没有读取文件,也没有在 elasticsearch 中创建索引 我需要在 elasticsearch 中读取 CSV 文件。 尝试对配置文件进行一些更改。
我的配置文件
input {
file {
type => "csv"
path => "/root/installables/*.csv"
start_position => beginning
}
}
filter {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
}
output {
elasticsearch {
hosts => localhost
index => "client"
}
}
谁能告诉我如何在 logstash 中加载 CSV 文件?
我认为你应该放一个 "csv" 过滤器。我让它像这样工作:
input {
file {
path => "/filepath..."
start_position => beginning
# to read from the beginning of file
sincedb_path => "/dev/null"
}
}
filter {
csv {
columns => ["COL1", "COL2"]
}
}
output {
stdout { codec => rubydebug }
elasticsearch {
host => "localhost"
index => "csv_index"
}
}
此外,添加标准输出作为输出有助于调试并了解文件是否正在加载