[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"}