标签:down tput test ado src 添加 efault stop asd
[root@server5 elk]# rpm -ivh logstash-2.3.3-1.noarch.rpmPipeline main has been shutdown
[root@server5 logstash]# /opt/logstash/bin/logstash -e ‘input {stdin { } } output { stdout { codec => rubydebug } elasticsearch { hosts => ["172.25.135.5"] index => "logstash-%{+YYYY.MM.dd}"} }‘
[root@server5 logstash]# cd /etc/logstash/conf.d/
[root@server5 conf.d]# ls
[root@server5 conf.d]# vim es.conf
[root@server5 conf.d]# /opt/logstash/bin/logstash -f /etc/logstash/conf.d/es.conf
[root@server5 conf.d]# cat /tmp/testfile
custom format: asdjkl
[root@server5 conf.d]# chmod 644 /var/log/messages
[root@server5 conf.d]# logger "hello" #没有日志文件写一些,有可略过
[root@server5 conf.d]# logger "hello"
[root@server5 conf.d]# logger "hello"
[root@server5 conf.d]# logger "hello"
[root@server5 conf.d]# vim es.conf
input {
file {
path => "/var/log/messages"
start_position => "beginning"
}
}
output {
elasticsearch {
hosts => ["172.25.135.5"]
index => "message-%{+YYYY.MM.dd}"
}
}
[root@server5 conf.d]# /opt/logstash/bin/logstash -f /etc/logstash/conf.d/es.conf
[root@server5 conf.d]# cd
[root@server5 ~]# l.
. .bashrc .pki
.. .cache .sincedb_452905a167cf4509fd08acb964fdb20c
.bash_history .cshrc .ssh
.bash_logout .mysql_history .tcshrc
.bash_profile .oracle_jre_usage .viminfo
[root@server5 ~]# cat .sincedb_452905a167cf4509fd08acb964fdb20c
267849 0 64768 517
[root@server5 ~]# ls -i /var/log/messages
267849 /var/log/messages #两者id一样
[root@server5 conf.d]# vim /etc/rsyslog.conf
.* @@172.25.135.5:514 #末尾添加,server7,8同样添加,同样重启以下服务
[root@server5 conf.d]# /etc/init.d/elasticsearch restart
[root@server5 conf.d]# /etc/init.d/rsyslog restart
[root@server5 conf.d]# vim es.conf
input {
syslog {
port => 514
}
}
output {
stdout {
codec => rubydebug
}
elasticsearch {
hosts => ["172.25.135.5"]
index => "message-%{+YYYY.MM.dd}"
}
}
[root@server5 conf.d]# /opt/logstash/bin/logstash -f /etc/logstash/conf.d/es.conf
#为了方便看:
可以给server7,8加点日志
[root@server7 ~]# logger server2
[root@server7 ~]# logger server2
[root@server7 ~]# logger server2
[root@server8 vm]# logger server3
[root@server8 vm]# logger server3
[root@server8 vm]# logger server3
刷新可以看出:
[root@server5 conf.d]# cd
[root@server5 ~]# l.
. .bash_profile .mysql_history .ssh
.. .bashrc .oracle_jre_usage .tcshrc
.bash_history .cache .pki .viminfo
.bash_logout .cshrc .sincedb_452905a167cf4509fd08acb964fdb20c
[root@server5 ~]# rm -fr .sincedb_452905a167cf4509fd08acb964fdb20c
[root@server5 ~]# cd -
/etc/logstash/conf.d
[root@server5 conf.d]# ls
es.conf
[root@server5 conf.d]# vim es.conf
input {
file {
path => "/var/log/elasticsearch/my-es.log"
start_position => "beginning"
}
}
#filter {
#}
output {
elasticsearch {
hosts => ["172.25.135.5"]
index => "es-%{+YYYY.MM.dd}"
}
}
[root@server5 conf.d]# /opt/logstash/bin/logstash -f /etc/logstash/conf.d/es.conf #新建es log
刷新浏览器可以看出:
标签:down tput test ado src 添加 efault stop asd
原文地址:http://blog.51cto.com/13810716/2328840