java版spring cloud+spring boot+re

2019-06-14  本文已影响0人  ITsupuerlady

elk 简介

elk下载安装

elk下载地址:https://www.elastic.co/downloads/

建议在 linux上运行,elk在windows上支持得不好,另外需要jdk1.8 的支持,需要提前安装好jdk.

下载完之后: 安装,以logstash为栗子:

cd /usr/local/
 
mkdir logstash
 
tar -zxvf logstash-5.3.2.tar.gz
 
mv logstash-5.3.2 /usr/local/logstash

配置、启动 Elasticsearch
打开Elasticsearch的配置文件:

vim config/elasticsearch.yml

修改配置:

network.host=localhost
network.port=9200

它默认就是这个配置,没有特殊要求,在本地不需要修改。

启动Elasticsearch

/bin/elasticsearch

启动成功,访问localhost:9200,网页显示:

{
  "name" : "56IrTCM",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "e4ja7vS2TIKI1BsggEAa6Q",
  "version" : {
    "number" : "5.2.2",
    "build_hash" : "f9d9b74",
    "build_date" : "2017-02-24T17:26:45.835Z",
    "build_snapshot" : false,
    "lucene_version" : "6.4.1"
  },
  "tagline" : "You Know, for Search"
}

配置、启动 logstash
在 logstash的主目录下:

vim config/log4j_to_es.conf

修改 log4j_to_es.conf 如下:

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.
  }
}

修改完配置后启动:

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

电子商务社交平台源码请加企鹅求求:叁五叁六贰四柒贰五九

上一篇 下一篇

猜你喜欢

热点阅读