字符串转换为float<2>

Configuration OK
zjtest7-frontend:/usr/local/logstash-2.3.4/config# ../bin/logstash -f g01.conf 
Settings: Default pipeline workers: 1
Pipeline main started
begin 123.456 end
{
         "message" => "begin 123.456 end",
        "@version" => "1",
      "@timestamp" => "2016-09-11T05:58:43.973Z",
            "host" => "0.0.0.0",
    "request_time" => 123.456,
            "test" => "aaaaaavvv"
}
^CSIGINT received. Shutting down the agent. {:level=>:warn}
stopping pipeline {:id=>"main"}
^CSIGINT received. Terminating immediately.. {:level=>:fatal}
zjtest7-frontend:/usr/local/logstash-2.3.4/config# ^C
zjtest7-frontend:/usr/local/logstash-2.3.4/config# cat g01.conf 
input {stdin{}}
 filter {
    grok {
     match => {
     "message" =>"\s+(?<request_time>\d+(?:\.\d+)?)\s+"}
     add_field =>["[test]","aaaaaavvv"]
     }
       mutate {  
                        convert => [ "request_time", "float"]  
               }  
 }
output {
      stdout {
               codec => rubydebug{}
                } 
}

posted @ 2016-09-11 14:03  czcb  阅读(137)  评论(0编辑  收藏  举报