字符串转换为float<1>
2024-08-27 05:10:01
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型
最新文章
- Asp.Net Core 项目实战之权限管理系统(0) 无中生有
- MyBatis源码分析-SQL语句执行的完整流程
- 自己总结的web前端知识体系大全【欢迎补充】
- Hibernate类中集合的映射
- directX学习系列8 颜色融合(转)
- handler机制的原理
- http-equiv
- Cassandra1.2文档学习(14)—— 事务和并发控制
- javascript中的 &;&; 与 || 的运用
- RabbitMQ Management HTTP API--官方文档
- “The SQL Server license agreenment cannot be located for the selected edition.”MSSQL安装问题
- 微信公众平台开发(一) ——实现URL接入
- c#添加事物(全部执行和带保存点的执行)
- IOS之【地图MapKit】
- SQL Server学习之路(七):Python3操作SQL Server数据库
- python模块安装报错 :error: command &#39;gcc&#39; failed with exit status 1
- Oracle:对用户的CREATE、ALTER、GRANT、REVOKE操作练习
- [USACO 04OPEN]MooFest
- 爬虫之proxy(代理)
- KeepAlived(三):vrrp实例故障转移(keepalived+haproxy)
热门文章
- library cache: mutex X
- NOI2011 兔兔与蛋蛋游戏
- Underscore.js(1.7.0) 中文文档 Underscore.js 入门
- C++中的重载、覆盖、隐藏
- python字符串(移除空白,长度,索引,分割,切片,拼接,格式化输出)
- C# 图结构操作
- javaweb文件下载
- iOS 部分问题总结2 - 苹果审核篇
- mysql学习之五:sql语句学习3
- 设计: ListView 接口,and the missing read-only interfaces in java collection framework