Run logstash with Docker and try uploading data to Elastic Cloud

environment

Environment: Elasticsearch uses Elastic Cloud logstash: 7.9.1 metricbeat: 7.9.1

Elastic Cloud is already set. Cloud Id and password are also noted.

The relationship between each function is like this

image21-1024x328.png

logstash image acquisition

Check the path of the latest image from the following

logstash | Docker @ Elastic

At the time of writing, the latest was 7.9.1.

docker pull docker.elastic.co/logstash/logstash:7.9.1

Start-up

docker run --rm -it -p 5044:5044 docker.elastic.co/logstash/logstash:7.9.1

Success if the following is displayed

[2020-09-22T02:58:20,563][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}

Start confirmation

$ docker ps

CONTAINER ID        IMAGE                                       COMMAND                  CREATED             STATUS              PORTS                              NAMES
b8867b83444c        docker.elastic.co/logstash/logstash:7.9.1   "/usr/local/bin/dock…"   7 minutes ago       Up 7 minutes        0.0.0.0:5044->5044/tcp, 9600/tcp   heuristic_mestorf

Metricbeat

Upload data to Elastic Cloud Create a data source with Metricbeat and send it to Logstash

Download Metricbeat Download Metricbeat • Ship Metrics to Elasticsearch | Elastic

Edit metricbeat.yml

Comment out elasticsearch and enable logstash

#output.elasticsearch:
# Array of hosts to connect to.
# hosts: ["localhost:9200"]

output.logstash:
  # The Logstash hosts
  hosts: ["localhost:5044"]

Run metricbeat.yml

./metricbeat -e

Check logstash

If the following is displayed on the logstash side, the data has been sent to metricbeat-> logstash.

{
    "@timestamp" => 2020-09-22T04:31:06.525Z,
         "event" => {
          "module" => "system",
        "duration" => 74705442,
         "dataset" => "system.process"
    },
       "service" => {
        "type" => "system"
    },
     "metricset" => {
          "name" => "process",
        "period" => 10000
    },
abridgement

Logstash setting change

By default, the received data is only output to the standard output, so change the setting to send the data to Elastic Cloud.

Check the Index name of the destination.

Throw Get like below to Endpoint

Get

https://xxxxxxxxxxx42b7b40a0773f8801e.us-east-1.aws.found.io:9243/_cat/indices?v

Add logstash.conf

Make the following contents in logstash.conf.

logstash.conf


input {
  beats {
    port => 5044
  }
}
output {
    elasticsearch {
        hosts => ["https://xxxxxxxxxxx42b7b40a0773f8801e.us-east-1.aws.found.io:9243"]
        user => "elastic"
        password => "xxxxxxxxxxxxxxxxxxxxx"
        index => "metricbeat-7.9.1-2020.09.22-000001"
    }
}

Restart logstash

docker run --rm -it -p 5044:5044 -v /Users/xxxxx/Documents/Logstash:/usr/share/logstash/pipeline/ docker.elastic.co/logstash/logstash:7.9.1 

Confirmed with Kibana

From Kibana's HOME screen, select Visualize and Explore Data → Metrics

スクリーンショット 2020-09-22 15.54.09.png

Select Host Metrics

スクリーンショット 2020-09-22 15.58.13.png

Success if displayed like this

スクリーンショット 2020-09-22 15.58.04.png

Recommended Posts

Run logstash with Docker and try uploading data to Elastic Cloud
Run Mosquitto with Docker and try WebSocket communication with MQTT
Write DiscordBot to Spreadsheets Write in Ruby and run with Docker
Microservices With Docker and Cloud Performance
How to run Blazor (C #) with Docker
Read the data of Shizuoka point cloud DB with Java and try to detect the tree height.
Try to link Ruby and Java with Dapr
Create jupyter notebook with Docker and run ruby
Android development-WEB access (POST) Try to communicate with the outside and send data. ~
Build Elastic Stack with Docker and analyze IIS logs
NLP4J [005-1] Try Twitter analysis with Twitter4J and NLP4J (data collection)
Run Pico with docker
Feel free to try Elasticsearch cluster with WSL2 + Docker
Try WildFly with Docker
Run Payara with Docker
Try connecting to AzureCosmosDB Emulator for Docker with Java
Serverless Java EE starting with Quarkus and Cloud Run
Make Docker confusing with Pokemon and make it easier to attach
Build a Node-RED environment with Docker to move and understand
Run TAO Core with Docker
Run Rails whenever with docker
Analyzing and visualizing csv logs with Excel Elastic Stack (docker-compose) --Two ways to deal with Logstash OutOfMemoryError
Try Oracle Enterprise Manager Cloud Control with Docker Desktop for Windows
Design patterns to try with Swift-Iterator patterns that support Arrays and Dictionary
(For myself) Try creating a C # environment with docker + code-server, cloud9
How to run a job with docker login in AWS batch
Run (provisionally) a Docker image with ShellCommandActivity on AWS Data Pipeline
Run lambda with custom docker image
Steps to run docker on Mac
Run SQL Server with Docker ToolBox
How to run JavaFX on Docker
Hello World with Docker and C
[Google Cloud] Getting Started with Docker
Try to imitate marshmallows with MiniMagick
Data linkage with Spark and Cassandra
Make JupyterLab run anywhere with docker
Update MySQL from 5.7 to 8.0 with Docker
Challenge to install WSL2 and docker
How to start Camunda with Docker
Wait for PostgreSQL to start with Docker and then start the WEB service
Android development-WEB access (GET) Try to get data by communicating with the outside. ~
[Node.js express Docker] How to define Docker environment variables and load them with node.js
Analyzing and visualizing csv logs with Excel Elastic Stack (docker-compose) --How to deal with data duplication errors in Elasticsearch