字符串转换为float

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+(?\d+(?:\.\d+)?)\s+"}
     add_field =>["[test]","aaaaaavvv"]
     }
       mutate {  
                        convert => [ "request_time", "float"]  
               }  
 }
output {
      stdout {
               codec => rubydebug{}
                } 
}

转载于:https://www.cnblogs.com/zhaoyangjian724/p/6199224.html

你可能感兴趣的:(字符串转换为float)