Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use docker compose to build an elk system

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to use docker compose to build an elk system, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Found a lot of blogs built using docker-elk, English reading is difficult to say, the mirror source is also slow to make people scalp numb, so rearranged a docker-compose, the sources are all found from https://hub.docker.com/, even if the domestic mirror source should be able to support very well, right?

Environment

Docker 18.06.0-ce

Docker-compose 1.22.0

Allocate at least 1 GB of memory to each container

Software version

Logstash: 5.*

Elasticsearch: 5.*

Kibana: 5.*

Pre-startup configuration

There are corresponding config configurations in each directory, which can be handled by themselves according to their own circumstances.

Take the configuration in the default logstash/confg/test.conf as an example:

Input {file {# the path here refers to the path in the logstash container. External access requires the use of volume for directory mapping path = > "/ logs/input/*"} # input stdin {} # in the logstash container because the local port 5000 is bound to the container port 5000 So you can test # echo "Test Logstash TCP Input Plugin" with the nc tool | nc localhost 5000 tcp {type = > "tcp" port = > 5000 mode = > "server"}} output {file {# where the path refers to the path in the logstash container External access needs to use volume for directory mapping path = > "/ logs/output/% {+ yyyy-MM-dd-HH} /% {host} .log"} stdout {codec = > rubydebug} elasticsearch {hosts = > "elasticsearch:9200" # the index set here will be used in kibana index = > "file-log-% {+ YYYY.MM}"}

Start the container

Execution

Git clone https://github.com/gaopengfei123123/docker-elk.git & & cd docker-elkdocker-compose up-d-- build

I will see the prompt of successful execution in a moment.

Creating docker-elk_elasticsearch_1... DoneCreating docker-elk_logstash_1... DoneCreating docker-elk_kibana_1... Done

Enter http://localhost:5601/ in the local browser to enter the kibana interface

Note that problems such as elasticsearch not found may appear when you start for the first time. You can wait for a minute or two to refresh. If it still doesn't work, Google or mention issue to solve it.

Enter in the same directory

Docker-compose stop

Then stop all services

Test it

Add a new test.log file to the logs/input/ directory, and then enter a point to verify it, or execute echo "Test Logstash TCP Input Plugin" on the command line | nc localhost 5000 sends logs through tcp.

Docker-compose logs-f

View the output of each container log

TODO

Introduce kafka as buffer

Set up es cluster

Github address

The above is all the contents of the article "how to use docker compose to build an elk system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report