【问题标题】:Logstash CSV output pluginLogstash CSV 输出插件
【发布时间】:2017-02-08 17:26:17
【问题描述】:

我正在使用 Logstash 解析包含单行 JSON 数据的文件,并将其输出为 CSV 格式的文件。它不是将数据输出为很好的分隔值,而是使用时间戳、主机和消息字段为我提供单行数据。我在 Logstash 官方论坛上找到了this question,但没有任何回应。有没有其他人遇到过这个问题并知道如何解决它或有任何建议?提前致谢。

输出

电流输出

2017-02-08T16:48:45.907Z %{host} %{message}
2017-02-08T16:48:45.907Z %{host} %{message}
2017-02-08T16:48:45.907Z %{host} %{message}
2017-02-08T16:48:45.907Z %{host} %{message}
2017-02-08T16:48:45.907Z %{host} %{message}
2017-02-08T16:48:45.907Z %{host} %{message}

期望的输出

timestamp, id, name
timestamp, id, name
timestamp, id, name

配置

input {
    file {
        path => "input path"
        sincedb_path => "C:\Logstash\.sincedb*"
        start_position => "beginning"
        codec => "json"
        type => "type"
    }
}

filter {
    mutate {
        add_field => {"eventName" => "%{[event][eventName]}"}
        add_field => {"uniqueDeviceID" => "%{[event][deviceSegment][uniqueDeviceID]}"}
    }
    prune {
        whitelist_names => ["eventName", "uniqueDeviceID", "@timestamp"]
    }
}

output {
    stdout {codec => rubydebug}
    csv {
        fields => ["uniqueDeviceID", "eventName", "@timestamp"]
        path => "output path"
    }
}

【问题讨论】:

标签: csv logstash logstash-configuration


【解决方案1】:
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多