Detailed process of installing logstash in Docker

Detailed process of installing logstash in Docker

Edit docker-compose.yml and add the following content:

version: '3'
services:
  logstash02:
    image: logstash:6.4.1
    hostname: logstash02
    container_name: logstash02
    ports:
      - "5045: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

The contents of the ./logstash/logstash.conf file are as follows:

version: '3'
services:
  logstash02:
    image: logstash:6.4.1
    hostname: logstash02
    container_name: logstash02
    ports:
      - "5045: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. When testing logstash,

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

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

bin/logstash -f <config_file.conf> --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:

Output to ES, file:

/usr/share/logstash/bin/logstash --path.data /usr/share/logstash/data02 -e 'input { stdin{} } output { elasticsearch {hosts => ["127.0.0.1:9200"] index => "logstashtest_%{+YYYY.MM.dd}" }}'

/usr/share/logstash/bin/logstash -e 'input { stdin{} } output { file { path => "/tmp/test_%{+YYYY.MM.dd}.log"}}'

This is the end of this article about installing logstash with Docker. For more information about installing logstash with Docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Docker installation of RocketMQ and solutions to problems encountered during installation
  • Docker-compose installation yml file configuration method
  • Detailed steps for installing ros2 in docker
  • The most detailed method to install docker on CentOS 8
  • The process of installing Docker on Windows Server 2016 and the problems encountered
  • Quick installation of Docker step-by-step tutorial

<<:  DIV common tasks (Part 1) — General tasks (show scrollbars/hide divs/disable event bubbling, etc.)

>>:  How to insert video into HTML and make it compatible with all browsers

Recommend

Design a simple HTML login interface using CSS style

login.html part: <!DOCTYPE html> <html l...

How to implement the strategy pattern in Javascript

Table of contents Overview Code Implementation Su...

Nginx+FastDFS to build an image server

Installation Environment Centos Environment Depen...

Detailed steps for running springboot project in Linux Docker

Introduction: The configuration of Docker running...

Tutorial diagram of installing CentOS and Qt in Vmware virtual machine

Vmware Installation Installing Packages Download ...

Vue+SSM realizes the preview effect of picture upload

The current requirement is: there is a file uploa...

JS Asynchronous Stack Tracing: Why await is better than Promise

Overview The fundamental difference between async...

MySQL database basic syntax and operation

MySQL database basic syntax DDL Operations Create...

Introduction to the use and difference between in and exists in MySQL

First put a piece of code for(int i=0;i<1000;i...

Hide div in HTML Hide table TABLE or DIV content css style

I solved a problem tonight that has been botherin...

Solution for applying CSS3 transforms to background images

CSS transformations, while cool, have not yet bee...