1
|
#wget http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz
|
1
2
|
# mkdir /usr/local/java
# tar -zxf jdk-8u45-linux-x64.tar.gz -C /usr/local/java/
|
1
2
3
4
|
# tail -3 ~/.bash_profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_45
export PATH=$PATH:$JAVA_HOME/bin
exportCLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATH
|
1
2
3
4
|
# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02,mixed mode)
|
1
2
|
# https://download.elastic.co/logstash/logstash/logstash-1.5.2.tar.gz
# tar –zxf logstash-1.5.2.tar.gz -C /usr/local/
|
1
2
3
4
|
# /usr/local/logstash-1.5.2/bin/logstash -e 'input { stdin { } } output { stdout {} }'
Logstash startup completed
Hello World!
2015-07-15T03:28:56.938Z noc.vfast.com Hello World!
|
1
2
3
4
5
|
# cat logstash-simple.conf
input { stdin { } }
output {
stdout { codec=> rubydebug }
}
|
1
2
3
4
5
6
7
8
9
10
11
|
# echo "`date` hello World"
Thu Jul 16 04:06:48 CST 2015 hello World
# /usr/local/logstash-1.5.2/bin/logstash agent -f logstash-simple.conf
Logstash startup completed
Tue Jul 14 18:07:07 EDT 2015 hello World #该行是执行echo “`date`hello World” 后输出的结果,直接粘贴到该位置
{
"message" => "Tue Jul 14 18:07:07 EDT 2015 helloWorld",
"@version" => "1",
"@timestamp" => "2015-07-14T22:07:28.284Z",
"host" => "noc.vfast.com"
}
|
1
|
# tar -zxf elasticsearch-1.6.0.tar.gz -C /usr/local/
|
1
|
# /usr/local/elasticsearch-1.6.0/bin/elasticsearch
|
1
|
# nohup /usr/local/elasticsearch-1.6.0/bin/elasticsearch >nohup &
|
1
2
|
# netstat -anp |grep :9200
tcp 0 0 :::9200 :::* LISTEN 3362/java
|
1
2
3
4
5
6
|
# cat logstash-es-simple.conf
input { stdin { } }
output {
elasticsearch {host => "localhost" }
stdout { codec=> rubydebug }
}
|
1
2
3
4
5
6
7
8
9
10
|
# /usr/local/logstash-1.5.2/bin/logstash agent -f logstash-es-simple.conf
… …
Logstash startup completed
hello logstash
{
"message" => "hello logstash",
"@version" => "1",
"@timestamp" => "2015-07-15T18:12:00.450Z",
"host" => "noc.vfast.com"
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# curl 'http://localhost:9200/_search?pretty'
返回结果
{
"took": 58,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits": {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "logstash-2015.07.15",
"_type" : "logs",
"_id" : "AU6TWiixxDXYhySMyTkP",
"_score" : 1.0,
"_source":{"message":"hellologstash","@version":"1","@timestamp":"2015-07-15T20:13:55.199Z","host":"noc.vfast.com"}
} ]
}
}
|
1
2
|
# cd /usr/local/elasticsearch-1.6.0/
# ./plugin -install lmenezes/elasticsearch-kopf
|
1
2
|
# ls plugins/
kopf
|
1
|
# tar -zxf kibana-4.1.1-linux-x64.tar.gz -C /usr/local/
|
1
|
# /usr/local/kibana-4.1.1-linux-x64/bin/kibana
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# cat /usr/local/logstash-1.5.2/logstash-indexer.conf
input {
file {
type =>"syslog"
path => ["/var/log/messages", "/var/log/syslog" ]
}
syslog {
type =>"syslog"
port =>"5544"
}
}
output {
stdout { codec=> rubydebug }
elasticsearch {host => "localhost" }
}
# /usr/local/logstash-1.5.2/bin/logstash -flogstash-indexer.conf
|
1
|
# echo "`date` 优衣库视频" >>/var/log/messages
|