0Pricing
System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry) · レッスン

Logstash:データ取り込みと処理

さまざまなソースからデータを収集、パース、変換するためのLogstashを使いこなします。堅牢なデータパイプラインに必要な一般的なフィルターや出力も学びます。

「Logstash:データ取り込みと処理」はCoddyKit上の無料System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry)レッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはSystem Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry)学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry)コースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Logstash: The Data Pipeline

Welcome to Logstash! In the ELK Stack, Logstash is your powerful, open-source data processing pipeline.

It's designed to ingest data from various sources, transform it, and then send it to various destinations, most commonly Elasticsearch.

Logstash's Core Architecture

Logstash operates on a simple, yet powerful, pipeline concept:

  • Inputs: Where data enters Logstash.
  • Filters: Where data is processed and transformed.
  • Outputs: Where processed data is sent.

Think of it as an assembly line for your logs!

Inputs: Gathering Your Logs

Inputs are the first stage of the pipeline. They define how Logstash collects data. There are many input plugins available for different sources.

Common input types include:

  • file: For reading log files from disk.
  • beats: For receiving data from Elastic Beats (like Filebeat).
  • tcp/udp: For network-based log collection.

Example: File Input

Here's a simple Logstash configuration snippet that sets up a file input plugin to read logs from a specific path.

This tells Logstash to monitor /var/log/my_app.log for new lines.

input {
  file {
    path => "/var/log/my_app.log"
    start_position => "beginning"
    # sincedb_path tracks read position. 
    # Use a persistent path in production.
    sincedb_path => "/dev/null"
  }
}

Filters: Making Sense of Data

Filters are the heart of Logstash's processing power. They take raw, unstructured data and transform it into structured, machine-readable events.

This is crucial for making your logs searchable and analyzable in Elasticsearch.

Grok Filter: Pattern Matching

The grok filter is incredibly powerful for parsing unstructured log data. It uses regular expressions combined with predefined patterns to extract specific fields.

For example, you can extract an IP address, a timestamp, or an HTTP method from a plain text log line.

Example: Grok Filter in Action

Consider a log line like: 192.168.1.1 GET /api/data 200 123ms

This grok filter extracts fields like clientip, method, request, response_code, and response_time.

filter {
  grok {
    match => { "message" => "%{IP:clientip} %{WORD:method} %{URIPATH:request} %{NUMBER:response_code:int} %{NUMBER:response_time:int}ms" }
  }
}

Other Useful Filters

While grok is essential, many other filters enhance your data:

  • date: Parses timestamps from log lines into a standard format.
  • mutate: Allows you to add, remove, rename, or modify fields.
  • json: Parses JSON strings within your log messages into structured fields.
  • kv: Extracts key-value pairs from a string.

Outputs: Sending Data Out

Outputs are the final stage of the Logstash pipeline. They define where your processed events are sent.

The most common output, especially in the ELK Stack, is elasticsearch. Other useful outputs include stdout (for debugging), file, or even message queues like kafka.

Logstash Pipeline Check

Let's test your understanding of Logstash's core components and how data flows through them.

Recap: Logstash, Your Data Processor

You've learned that Logstash is a vital component of the ELK Stack, acting as a flexible data processing engine.

  • It uses Inputs to gather data.
  • Filters (like grok) to parse and enrich that data.
  • And Outputs to send the processed, structured events to destinations like Elasticsearch.

This transforms raw logs into valuable, searchable information!

よくある質問

「Logstash:データ取り込みと処理」レッスンは無料ですか?

はい。「Logstash:データ取り込みと処理」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry)コースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry)コースには全4レッスンが含まれています。

「Logstash:データ取り込みと処理」で何を学びますか?

さまざまなソースからデータを収集、パース、変換するためのLogstashを使いこなします。堅牢なデータパイプラインに必要な一般的なフィルターや出力も学びます。 ブラウザで直接実行するハンズオンコードでSystem Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry)を演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry)を始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのSystem Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry)は初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。

「Logstash:データ取り込みと処理」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このSystem Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry)レッスンでコードを書いて実行できますか?

はい。すべてのSystem Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry)レッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. Elasticsearch:インデックス作成と検索
  2. Logstash:データ取り込みと処理
  3. Kibana:可視化とダッシュボード
  4. Beats:軽量データシッパー
← System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry)に戻る