Elk profile

  • Elasticsearch is an open source distributed search engine. It features distributed, zero configuration, automatic discovery, index sharding, index copy, restful interface, multiple data sources, and automatic search load.

  • Logstash is a completely open source tool that collects, filters, and stores your logs for future use (e.g., searching).

  • Kibana is also an open source and free tool that provides a log analysis friendly Web interface for Logstash and ElasticSearch to help you aggregate, analyze and search important data logs.

Elk download and install

Elk download address: www.elastic.co/downloads/

It is recommended to run on Linux, elK is not well supported on Windows, in addition, jdK1.8 support is required, you need to install JDK in advance.

After downloading: Install with logstash as chestnut:

1
2
3
4
5
6
7
cd /usr/local/
mkdir logstash
tar -zxvf logstash-
5.3
.
2
.tar.gz
mv logstash-
5.3
.
2
/usr/local/logstash

  

Configure and start Elasticsearch

Open the Elasticsearch configuration file:

1
vim config/elasticsearch.yml

Modify the configuration:

1
2
network.host=localhost
network.port=
9200

  

It defaults to this configuration, with no special requirements and no need to change it locally.

Start the Elasticsearch

1
./bin/elasticsearch

Localhost :9200

1
2
3
4
5
6
7
8
9
10
11
12
13
{

"name"
:
"56IrTCM"
.

"cluster_name"
:
"elasticsearch"
.

"cluster_uuid"
:
"e4ja7vS2TIKI1BsggEAa6Q"
.

"version"
: {

"number"
:
"5.2.2."
.

"build_hash"
:
"f9d9b74"
.

"build_date"
:
"The 2017-02-24 T17: he. 835 z"
.

"build_snapshot"
:
false
.

"lucene_version"
:
6.4.1 ""

},

"tagline"
:
"You Know, for Search"
}

  

Configure and start the Logstash

In the logstash home directory:

1
vim config/log4j_to_es.conf

Modify log4j_to_es. Conf as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
input {

log4j {

mode =>
"server"

host =>
"localhost"

port =>
4560

}
}
filter {

#Only matched data are send to output.
}
output {

elasticsearch {

action =>
"index"
#The operation on ES

hosts =>
"localhost:9200"
#ElasticSearch host, can be array.

index =>
"applog"
#The index to write data to.

}
}

Start after modifying the configuration:

1
./bin/logstash -f config/log4j_to_es.conf

The architecture code is as follows:


Spring Cloud large enterprise distributed micro service Cloud to build B2B2C e-commerce platform source code please add penguin beg: 10387746626