mutate 类型转换
生活随笔
收集整理的這篇文章主要介紹了
mutate 类型转换
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
[elk@Vsftp logstash]$ cat grok.conf
input {stdin {}}
filter {
grok {
match =>{
"message" =>"s+(?<request_time>d+(?:.d+)?)s+"
}
}
}
output {
stdout {
codec => rubydebug
}
}
[elk@Vsftp logstash]$ logstash -f grok.conf
Settings: Default pipeline workers: 4
Pipeline main started
BEGIN 123.321 END
{
"message" => "BEGIN 123.321 END",
"@version" => "1",
"@timestamp" => "2017-02-08T07:08:17.638Z",
"host" => "Vsftp",
"request_time" => "123.321"
}
可以看到這里時間變成了字符串
[elk@Vsftp logstash]$ cat grok.conf
input {stdin {}}
filter {
grok {
match =>{
"message" =>"s+(?<request_time>d+(?:.d+)?)s+"
}
}
mutate {
convert =>["request_time","float"]
}
}
output {
stdout {
codec => rubydebug
}
}
[elk@Vsftp logstash]$ logstash -f grok.conf
Settings: Default pipeline workers: 4
Pipeline main started
BEGIN 123.321 END
{
"message" => "BEGIN 123.321 END",
"@version" => "1",
"@timestamp" => "2017-02-08T07:11:06.794Z",
"host" => "Vsftp",
"request_time" => 123.321
}
把字符串轉換我float
總結
以上是生活随笔為你收集整理的mutate 类型转换的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 连通图与完全图的区别
- 下一篇: 17-网页,网站,微信公众号基础入门(使