logstash 通过type判断
[elk@zjtest7-frontend type]$ cat input.conf
input {
file {
type => "type_a"
path => ["/usr/local/logstash-2.3.4/config/type/a.txt"]
} file {
type => "type_b"
path => ["/usr/local/logstash-2.3.4/config/type/b.txt"]
} } output {
if [type] == "type_a" {
redis {
host => "192.168.32.67"
data_type => "list"
key => "type_a:redis"
port=>"6379"
password => "1234567"
}
}
else if [type] == "type_b"{
redis {
host => "192.168.32.67"
data_type => "list"
key => "type_b:redis"
port=>"6379"
password => "1234567"
}
}
}
--------------------------------------------------- [elk@zjtest7-frontend type]$ cat output.conf
input { redis {
host => "192.168.32.67"
data_type => "list"
key => "type_a:redis"
password => "1234567"
port =>"6379"
} redis {
host => "192.168.32.67"
data_type => "list"
key => "type_b:redis"
password => "1234567"
port =>"6379"
} }
output {
if [type] == "type_a"{
stdout {
codec => rubydebug
}
}
else if [type] == "type_b"{
stdout {
codec =>json
} } } [elk@zjtest7-frontend type]$ ../../bin/logstash -f output.conf
Settings: Default pipeline workers: 1
Pipeline main started
{
"message" => "aaaaaaaa",
"@version" => "1",
"@timestamp" => "2016-09-16T06:26:07.211Z",
"path" => "/usr/local/logstash-2.3.4/config/type/a.txt",
"host" => "0.0.0.0",
"type" => "type_a"
} {"message":"aaaaaaaa","@version":"1","@timestamp":"2016-09-16T06:26:31.079Z","path":"/usr/local/logstash-2.3.4/config/type/b.txt","host":"0.0.0.0","type":"type_b"}
logstash 通过type判断的更多相关文章
- logstash 根据type 判断输出
# 更多ELK资料请访问 http://devops.taobao.com 一.配置前需要注意: 1.Use chmod to modify nginx log file privilege. E.g ...
- Logstash type来标记事件类型,通过type判断
/*************** 根据type判断 input { file { type => "zj_frontend_access" path => [" ...
- 浏览器解析js和type判断数据类型
### 浏览器解析: - 1.当浏览器(内核.引擎)解析和渲染js的时候,会给js提供一个运行的环境,这个环境叫做“全局作用域(后端global / 客服端window scope)” - 2.代码自 ...
- 类型(type)判断
windows下源文件编码问题 在windows下不要直接右击桌面创建.txt再改成.c,这种方式容易引起编码问题 windows下gvim的设置: 先打开gvim再用:w newfile.c这种方式 ...
- Python中为什么推荐使用isinstance来进行类型判断?而不是type
转自:http://www.xinxingzhao.com/blog/2016/05/23/python-type-vs-isinstance.html Python在定义变量的时候不用指明具体的的类 ...
- .NET(C#):判断Type类的继承关系
//Type类的函数 class Type bool IsInstanceOfType(object); //判断对象是否是指定类型 //类型可以是父类,接口 //用法:父类.IsInstanceOf ...
- ELK学习笔记之Logstash详解
0x00 Logstash概述 官方介绍:Logstash is an open source data collection engine with real-time pipelining cap ...
- logstash之Input插件
1:stdin标准输入和stdout标准输出 首先执行命令: bin/logstash -e 'input { stdin { } } output { stdout { codec => ...
- Python 判断变量的类型
这里有两种方法.type 和isinstance import types aaa = 0 print type(aaa) if type(aaa) is types.IntType: print & ...
随机推荐
- [LeetCode] 45. Jump Game II 解题思路
Given an array of non-negative integers, you are initially positioned at the first index of the arra ...
- New Year Permutation(Floyd+并查集)
Description User ainta has a permutation p1, p2, ..., pn. As the New Year is coming, he wants to mak ...
- (转)pem, cer, p12 and the pains of iOS Push Notifications encryption
转自:http://cloudfields.net/blog/ios-push-notifications-encryption/ The serious pains of setting up a ...
- 使用断言assert
之前有看过关于Assert的书,但是不懂得如何去用,最近看别人写的代码有用这个断言(assert),今天自己动手看看如何使用断言. 断言(assert)的语义如下:如果表达式的值为0(假),则输出错误 ...
- Java基础知识强化41:StringBuffer类之StringBuffer的反转功能
1. StringBuffer 的反转功能: public StringBuffer reverse(): 2. 案例演示: package cn.itcast_05; /* * StringBuff ...
- linux增大交换分区
进来在批量搭建环境,遇到搭建完环境之后发现swap忘记的情况,后来百度了下,发现了下面的方法,网上可能存在好多相应的帖子说这个事情也比较简单,以下是自己实践的结果,分享给大家. 1.查看现有memor ...
- 网页、JavaScript 的DOM操作
HTML DOM (文档对象模型) 当网页被加载时,浏览器会创建页面的文档对象模型(Document Object Model). HTML DOM 模型被构造为对象的树. Windows 对象操作 ...
- Java 图片切圆角,消除锯齿
public static BufferedImage setBorderRadius(BufferedImage srcImage, int radius){ int width = srcImag ...
- 对于数据操作的SQL语句精粹(长期更新)
--删除空格 Update [Table] Set [Column]=Replace([Column],' ','') --查出左右和右边带空格的数据 select RTRIM( LTRIM([Col ...
- 浅谈MDX处理空值NULL及格式化结果
MDX查询结果中往往会含有"NULL"值,这是某维度下对应的的量值不存在导致的,为了让报表呈现更好的效果,在有些情况下,需要将"NULL"的切片值置换成0,这些 ...