Logstash配置文件处理日志时间
将SpringBoot生成的日志文件,通过Logstash传输到Elasticsearch。日志文件内容格式如下
2019-11-12 22:01:23.358 调用==>用户退出登录接口参数=>"{\"phone\":\"17010058888\",\"token\":\"oo:8da500acb09d7e3ef2e9e61dcc6b5908\"}"
编写logstash.conf文件,内容如下,将日志打印的时间戳转换为timestamp类型
input { file { type => "auth_log" path => ["/logs/auth.log"] start_position => "beginning" sincedb_path => "/dev/null" } } filter { grok { match => { "message" => "\s*%{TIMESTAMP_ISO8601:time}\s*%{NOTSPACE:rest}" } } date { match => ["time", "yyyy-MM-dd HH:mm:ss.SSS"] target => "@timestamp" } mutate { remove_field =>["message"] } } output { elasticsearch { hosts => "ip:9200" index => "logstash-%{+YYYY.MM.dd}" } }
相关推荐
goodstudy 2020-08-19
weikaixxxxxx 2020-08-01
liulin0 2020-07-26
AFei00 2020-07-26
娜娜 2020-07-20
偏头痛杨 2020-07-18
winxcoder 2020-07-18
superviser000 2020-06-28
liulin0 2020-06-25
liulin0 2020-06-16
wangfengqingyang 2020-06-11
cullinans 2020-06-09
winxcoder 2020-06-08
citic 2020-06-06
goodstudy 2020-06-05
superviser000 2020-05-30
yuzhongdelei0 2020-05-15
wzhwangzhuohui 2020-05-12
李玉志 2020-05-11