Get the App
SLTechnology News&Howtos  ›  Development  › 

How to install logstash on Docker

Shulou Source: shulou.com Published: 2022-06-03 09:32:18 11月15日 Update

This article mainly explains "how to install logstash on Docker". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to install logstash on Docker".

Edit the docker-compose.yml as follows:

Version: '3'services: logstash02: image: logstash:6.4.1 hostname: logstash02 container_name: logstash02 ports:-"5045 restart 5045" # set port environment: XPACK_MONITORING_ENABLED: "false" pipeline.batch.size: 10 volumes: -. / logstash/logstash.conf:/usr/share/logstash/pipeline/logstash.conf network_mode: "host" restart: always

. / logstash/logstash.conf file is as follows:

Version: '3'services: logstash02: image: logstash:6.4.1 hostname: logstash02 container_name: logstash02 ports:-"5045 restart 5045" # set port environment: XPACK_MONITORING_ENABLED: "false" pipeline.batch.size: 10 volumes: -. / logstash/logstash.conf:/usr/share/logstash/pipeline/logstash.conf network_mode: "host" restart: always

Then run docker-compose up to start the logstash container, and during the logstash test

/ usr/share/logstash/bin/logstash-e 'input {stdin {} output {stdout {codec = > rubydebug}}'

You will be prompted that the logstash instance already exists. If you want to run multiple logstash instances, you need to define the path.data through the command, as follows:

Bin/logstash-f-- path.data PATH/usr/share/logstash/bin/logstash-- path.data / usr/share/logstash/data02-e 'input {stdin {} output {stdout {codec = > rubydebug}}'

The output is as follows:

Export to ES, file:

/ usr/share/logstash/bin/logstash-- path.data / usr/share/logstash/data02-e 'input {stdin {} output {elasticsearch {hosts = > ["127.0.0.1 YYYY.MM.dd 9200"] index = > "logstashtest_% {+ YYYY.MM.dd}"}' / usr/share/logstash/bin/logstash-e 'input {stdin {} output {file {path = > "/ tmp/test_% {+ YYYY.MM.dd} .log"}' Thank you for reading The above is the content of "how to install logstash on Docker". After the study of this article, I believe you have a deeper understanding of how to install logstash on Docker, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Content learning examples files ports output runs commands multiple containers that is ideas situations articles times more knowledge knowledge points articles follow Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Tech Info Redmi Huawei macOS