zoukankan      html  css  js  c++  java
  • logstash使用分享

    1、logstash时间处理函数

     当业务场景需要自有的time字段覆盖@timestamp字段的情况下 需要使用

    date {
                    match => ["time", "dd-MMM-yyyy HH:mm:ss.SSS","yyyy-MM-dd'T'HH:mm:ss"]
                    target => "@timestamp"
            }

    当处理完以后会发现@timestamp的值跟你的time字段值还是不一样

    查看解析结果发现@timestamp比中国时间早了8小时

    对于页面查看,ELK 的解决方案是在 Kibana 上,读取浏览器的当前时区,然后在页面上转换时间内容的显示

    解决方案找到两个

    vim vendor/bundle/jruby/1.9/gems/logstash-core-event-2.3.3-java/lib/logstash/timestamp.rb
    把@time = time.utc 改成time即可
    z
    这种方式如果觉得修改代码不够友好的话还有一种方式:
      date {
            match => ["timestamp", "dd/MMM/yyyy:HH:mm:ss +0800"]
            target => "@timestamp"
            "locale" => "en"
            timezone => "UTC"
        }
  • 相关阅读:
    Combination Sum
    Partition List
    Binary Tree Zigzag Level Order Traversal
    Unique Binary Search Trees II
    Count and Say
    Triangle
    3Sum Closest
    Search for a Range
    Longest Common Prefix
    Convert Sorted List to Binary Search Tree
  • 原文地址:https://www.cnblogs.com/wq920/p/7839907.html
Copyright © 2011-2022 走看看