zoukankan      html  css  js  c++  java
  • 字符串转换为float

    zjtest7-frontend:/usr/local/logstash-2.3.4/config# cat g01.conf 
    input {stdin{}}
     filter {
        grok {
         match => {
         "message" =>"s+(?<request_time>d+(?:.d+)?)s+"
         }
       }
         mutate {  
                            convert => [ "request_time", "float"]  
                   }  
     }
    output {
          stdout {
                   codec => rubydebug{}
                    } 
    }
    
    
    
    
    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:31:32.576Z",
                "host" => "0.0.0.0",
        "request_time" => "123.456"
    }
    
    此时  "request_time" => "123.456" 输出的是字符串
    
    zjtest7-frontend:/usr/local/logstash-2.3.4/config# cat g01.conf 
    input {stdin{}}
     filter {
        grok {
         match => {
         "message" =>"s+(?<request_time>d+(?:.d+)?)s+"
         }
       }
           mutate {  
                            convert => [ "request_time", "float"]  
                   }  
     }
    output {
          stdout {
                   codec => rubydebug{}
                    } 
    				
    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:34:13.040Z",
                "host" => "0.0.0.0",
        "request_time" => 123.456
    }
    
    把字符串转换为	float型

  • 相关阅读:
    Java 原理性文章收录
    kafka connect userguide【confluence】
    curl 工具使用
    MySQL 数据类型
    Kafka Producer (0.10.0.0)原理
    Kafka Consumer 原理与实践
    java 泛型详解
    redis 高可用集群之水平扩展
    Redis 5.0.0 安装(集群)
    Apollo(阿波罗)架构深度剖析
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350280.html
Copyright © 2011-2022 走看看