This is the 15th day of my participation in the August More text Challenge. For details, see: August More Text Challenge

If ❤️ my article is helpful, welcome to like, follow. This is the greatest encouragement for me to continue my technical creation. More past articles in my personal column

preface

Install Elasticsearch on Linux. Install Elasticsearch on Linux. Install Elasticsearch on Linux.

This section mainly explains that L in ELK stands for Logstash and k: Kibana

Download and install logStash

Start the logstash

bin/logstash -f logstash.conf

Download Java and decompress the installation

Wget repo.huaweicloud.com/java/jdk/11… tar zxvf jdk-8u251-linux-x64.tar.gz

Configure Java system variables

vi /etc/profile # java set export JAVA_HOME=/work/env/jdk11 export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin Run the source /etc/profile command to take effect immediately.Copy the code

Configuring environment variables here will enable other users to use the JDK, and if only one user can use the environment variables you should configure them in that user’s home directory

vim .bash_profile

# java set
export JAVA_HOME=/work/env/jdk11
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
Copy the code

Start the logstash bin/logstash -f config/logstash

Configuration logstash. Conf

Prepare the logstash configuration file

Input {file {path => "/work/env/elk/logstash-7.8.0/data/ films.csv "start_position => "beginning" sincedb_path => "/dev/null" } } filter { csv { separator => "," columns => ["id","content","genre"] } mutate { split => { "genre" => "|"  } remove_field => ["path", "host","@timestamp","message"] } mutate { split => ["content", "("] add_field => { "title" => "%{[content][0]}"} add_field => { "year" => "%{[content][1]}"} } mutate { convert => { "year" => "integer" } strip => ["title"] remove_field => ["path", "Host ","@timestamp","message","content"]}} output {hosts => "http://127.0.0.1:9200" index => "movies"  document_id => "%{id}" } stdout {} }Copy the code

kibana

Download kibana

Domestic mirror: www.newbe.pro/tags/Mirror…

  • Filebeat: www.newbe.pro/Mirrors/Mir…
  • Elasticsearch: www.newbe.pro/Mirrors/Mir…
  • Kibana: www.newbe.pro/Mirrors/Mir…
  • Logstash: www.newbe.pro/Mirrors/Mir…
  • The RabbitMQ: www.newbe.pro/Mirrors/Mir…

Kibana Linux installation

Kibana # download package wget https://mirrors.huaweicloud.com/kibana/7.8.0/kibana-7.8.0-linux-x86_64.tar.gz # decompression and enter kibana folder Tar - ZXVF kibana - 7.8.0 - Linux - x86_64, tar, gz & CD kibana - 7.8.0 # configuration files The following content vim config/kibana yml # -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Hosts: ["http://127.0.0.1:9200"] i18n.locale: "zh-cn"Copy the code

Start the kibana

Bin /kibana # Start kibana http://localhost:5601

Useful Dev tool

Kibana command

  • bin/kibana-plugin list
  • bin/kibana-plugin remove
  • Bin /kibana-plugin install analysis-icu