logstash-forwarder.crt
logstash-forwarder.key
cd /opt/file
keytool -importcert -trustcacerts -file logstash-forwarder.crt -alias ca -keystore keystore.jks
说明:
keytool:是java/bin命令
-alias ca ca指的是客户端AIX服务器域名
例如:scp keystore.jks 用户名@130.30.1.107.171://opt/目录
input{
lumberjack {
port => 5120//要跟客户端一致
ssl_certificate => "/opt/file/logstash-forwarder.crt"
ssl_key => "/opt/file/logstash-forwarder.key"
type => "access"//要跟客户端一致,可以分类型处理。
}
}
filter { //可以不过滤,此段删除。
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
}
output {
elasticsearch {//支持es,亦可以删除
index => "gzns_access"
document_type => "access"
hosts => ["GIT-003.hadoop:9200"]
workers => 1
flush_size => 100
idle_flush_time => 10
}
kafka{//支持kafka,内容后补(名称暂时,可选)
index => "gzns_access"
document_type => "access"
hosts => ["GIT-003.hadoop:9200"]
workers => 1
flush_size => 100
idle_flush_time => 10
}
//输出控制台(可选)
stdout{codec==>rubydebug}
}
解释说明:
port:同客户端输出端口一样;
ssl_certificate和ssl_key分别指向/opt/file/下两个文件
type:增加日志输出类型
logstach.yml
放开node节点的注释,并修改服务器名。注意:后面一定要添加一个空格!
/usr/local/test/logstash
.logstash-forwarder-java
keystore.jks
logstash-forwarder-java-0.2.4.jar
test.conf
该文件的目的是为了记录每个日志文件当前处理到第几行。
修改内容为{},花括号里没有[],否则进程启动会报空指针异常
清除里面原来的所有内容,留一个[]即可。
{
"network": {
"servers":["96.0.50.78:5120"],
"ssl ca":"/home/was/logstash/keystore.jks",
"timeout":5
},
"files": [
{
"paths": ["/backup/mondata/jxj.nmon"],
"fields": {
"type": "access"
}
}
]
}
解释说明:
Aix用的一般是gb2312,而其他服务器用的通常是utf-8.
servers:指向server端的IP和port
ssl ca:指向密钥文件keystore.jks
cd /home/was/logstash
nohup java -jar logstash-forwarder-java-0.2.4.jar -quiet -config test.conf > logforwarder.log &
解析说明:
-quiet:参数可以大大减少不必要的日志量,如果遇到错误请打开-debug和-trace选项
https://github.com/chenryn/ELKstack-guide-cn/commit/b79047ac51baeec90f5850f2e86eb16982e90d73
https://github.com/didfet/logstash-forwarder-java
logstash-forwarder + logstash + elasticsearch + kibana:
http://www.cnblogs.com/xiaouisme/p/3977721.html