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

    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型

  • 相关阅读:
    设计模式-单列模式
    linux udp c/s
    linux 命令
    java String
    [转]Android进程间通信--消息机制及IPC机制实现
    Android入门:Activity四种启动模式
    CRT 重启Was
    jquery.cookie.js 使用
    div设置contentEditable="true"作为文本编辑器,定位光标解决办法
    居中展示图片
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199225.html
Copyright © 2011-2022 走看看