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

Solution to the problem of insufficient storage resource pool of Docker server

Table of contents 1. Problem Description 2. Probl...

How to build a virtual machine with vagrant+virtualBox

1. Introduction Vagrant is a tool for building an...

How to use html table (to show the visual effect of web page)

We know that when using HTML on NetEase Blog, we ...

Scary Halloween Linux Commands

Even though it's not Halloween, it's wort...

Detailed explanation of Linx awk introductory tutorial

Awk is an application for processing text files, ...

Use neat HTML markup to build your pages

The Internet is an organism that is constantly ev...

Example of Vue routing listening to dynamically load the same page

Table of contents Scenario Analysis Development S...

JavaScript to achieve dynamic color change of table

This article shares the specific code for JavaScr...

Oracle deployment tutorial in Linux environment

1. Environment and related software Virtual Machi...

Detailed explanation of mixed inheritance in Vue

Table of contents The effect of mixed inheritance...

my.cnf (my.ini) important parameter optimization configuration instructions

MyISAM storage engine The MyISAM storage engine i...

Detailed steps to install docker in 5 minutes

Installing Docker on CentOS requires the operatin...

Introduction and analysis of three Binlog formats in MySQL

one. Mysql Binlog format introduction Mysql binlo...

Vue realizes price calendar effect

This article example shares the specific code of ...