grok 添加字段
filter {
grok {
match =>[
"message","%{IPORHOST:clientip} \[%{HTTPDATE:time}\] \"%{WORD:verb} %{URIPATHPARAM:request}\?.* HTTP/%{NUMBER:httpversion}\" \- %{NUMBER:http_status_code} %{NUMBER:bytes} \"(? <http_referer>\S+)\" \"(?<http_user_agent>(\S+\s+)*\S+)\" (%{BASE16FLOAT:request_time}) (%{IPORHOST:http_x_forwarded_for}|-)",
"message" , "%{IPORHOST:clientip} \[%{HTTPDATE:time}\] \"%{WORD:verb} %{URIPATHPARAM:request} HTTP/%{NUMBER:httpversion}\" \- %{NUMBER:http_status_code} %{NUMBER:bytes} \"(? <http_referer>\S+)\" \"(?<http_user_agent>(\S+\s+)*\S+)\" (%{BASE16FLOAT:request_time}) (%{IPORHOST:http_x_forwarded_for}|-)" ]
}
geoip {
source => "http_x_forwarded_for"
target => "geoip"
database => "/usr/local/logstash-2.3.4/etc/GeoLiteCity.dat"
add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}" ]
add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}" ]
}
mutate {
convert => [ "[geoip][coordinates]", "float"]
} } /******************* zjtest7-frontend:/usr/local/logstash-2.3.4/config# cat geoip.conf
input {stdin {} } filter {
geoip {
source =>"message"
}
} output {
stdout {
codec => rubydebug{}
}
} zjtest7-frontend:/usr/local/logstash-2.3.4/config# ../bin/logstash -f geoip.conf
Settings: Default pipeline workers: 1
Pipeline main started
202.101.172.35
{
"message" => "202.101.172.35",
"@version" => "1",
"@timestamp" => "2016-09-11T02:54:11.116Z",
"host" => "0.0.0.0",
"geoip" => {
"ip" => "202.101.172.35",
"country_code2" => "CN",
"country_code3" => "CHN",
"country_name" => "China",
"continent_code" => "AS",
"latitude" => 35.0,
"longitude" => 105.0,
"location" => [
[0] 105.0,
[1] 35.0
]
}
} /*******************添加字段
zjtest7-frontend:/usr/local/logstash-2.3.4/config# cat geoip.conf
input {stdin {} } filter {
geoip {
source =>"message"
add_field => [ "[geoip][scantest]", "%{[geoip][location][0]}" ]
}
} output {
stdout {
codec => rubydebug{}
}
} zjtest7-frontend:/usr/local/logstash-2.3.4/config# ../bin/logstash -f geoip.conf
Settings: Default pipeline workers: 1
Pipeline main started
202.101.172.35
{
"message" => "202.101.172.35",
"@version" => "1",
"@timestamp" => "2016-09-11T02:57:07.832Z",
"host" => "0.0.0.0",
"geoip" => {
"ip" => "202.101.172.35",
"country_code2" => "CN",
"country_code3" => "CHN",
"country_name" => "China",
"continent_code" => "AS",
"latitude" => 35.0,
"longitude" => 105.0,
"location" => [
[0] 105.0,
[1] 35.0
],
"scantest" => 105.0
}
}
grok 添加字段的更多相关文章
- Sql动态添加字段的正确姿势
如何给指定表动态添加字段? 一.创建一张表[Tbl_AutoFileds] (tableName表名,fieldName字段名,dataType数据类型,length长度 isnull 是否允许为n ...
- paip.解决 数据库mysql增加列 字段很慢添加字段很慢
paip.解决 数据库mysql增加列 字段很慢添加字段很慢 #环境如下: mysql5.6 数据仅仅3w alter table xxx add column yyy int default ...
- MySQL添加字段和删除字段
MySQL添加字段应该如何实现呢?这是很多刚刚接触MySQL数据库的新人都提到过的问题,下面就为您介绍MySQL添加字段和删除字段的方法,希望对您能有所启迪. MySQL添加字段: alter tab ...
- 向已写好的多行插入sql语句中添加字段和值
#region 添加支款方式--向已写好的多行插入sql语句中添加字段和值 public int A_ZhifuFS(int diqu) { ; string strData = @"SEL ...
- mysql 添加字段、删除字段、调整字段顺序 转
ALTER TABLE — 更改表属性添加字段: alter table `user_movement_log`Add column GatewayId int not null default 0 ...
- PHPCMS v9栏目添加字段及描述编辑器修改方法
为PHPCMS v9栏目添加字段和把描述的textarea编辑器变成fceditor编辑器的方法.如下: 1. 添加数据库字段:description1,添加位置:v9_catetory表 2. 在c ...
- oracle数据库的建表,删除字段,添加字段,修改字段,修改字段......
1. 使用oracle创建一张表: SQL> create table loginuser( id ,), username ), password ), email ), descriable ...
- Sql 语句添加字段、修改字段类型、默认值语法
Sql 语句添加字段 ,) not null --修改类型 alter Table bbs ) Sql 语句修改默认值 alter table 表名 drop constraint 约束名字 --删除 ...
- ArcEngine 添加字段
private void AddField(IFeatureClass pFeatureClass, string name, string aliasName, esriFieldType Fiel ...
随机推荐
- 鼠标键盘无法进入:(EE) config/hal: couldn’t initialise context: (null)
vi /var/log/Xorg.0.log 发现有一行:(EE) config/hal: couldn’t initialise context: (null) 在xorg.conf里面加上下面选项 ...
- Linux企业级项目实践之网络爬虫(15)——区分文本文件和二进制文件
HTTP协议支持文本和二进制文件传输.最常见的html格式的页面即文本,图片.音乐等为二进制文件.我们要对这两类文件加以区分并分别处理. static char * BIN_SUFFIXES = &q ...
- 快速理解RequireJs
原文地址:http://www.tuicool.com/articles/jam2Anv RequireJs已经流行很久了,我们在项目中也打算使用它.它提供了以下功能: 声明不同js文件之间的依赖 可 ...
- 一个session已经ACTIVE20多小时,等待事件SQL*Net more data from client
问题描述: 一个session已经ACTIVE20多小时,等待事件SQL*Net more data from client 有一人session,从昨天上午11点多登陆(v$session.logi ...
- c语言输出可见字符
#include <stdio.h> void main() { int i; //可见字符是32-126 ;i<;i++) { putchar(i); } getchar(); }
- 关于bootstrap--表格(table的各种样式)
1.table-striped:斑马线表格 2.table-bordered:带边框的表格 3.table-hover:鼠标悬停高亮的表格 4.table-condensed:紧凑型表格(单元格的内距 ...
- git hub 资料汇总
tobecrazy Selenium automation test framework https://github.com/tobecrazy/Demo Smartphone Test F ...
- Spring3 MVC 之 Hello Word
开发工具: MyEclipse 10.0 项目目录: [http://www.cnblogs.com/rhythmK/] 1.新建项目:File->New->Web Project 项 ...
- android layout属性介绍
android:id 为控件指定对应的ID android:text 指定控件其中显示的文字,须要注意的是,这里尽量使用strings.xml文件其中的字符串 android:gravity 指定Vi ...
- Swift自适应布局(Adaptive Layout)教程(二)
给TextContainer中添加内容 打开 Main.storyboard ,从组件库(Object Library)中拖拽两个 Label 组件到TextContainer中,位置可以随意摆放: ...