# Logstash ์„ค์น˜

img


# ์‹ค์Šต ํ™˜๊ฒฝ


# 1. Logstash๋ž€?

Logstash๋Š” Input์„ ๋‹ด๋‹นํ•œ๋‹ค.

Input์œผ๋กœ ๋“ค์–ด์˜จ data๊ฐ€ logstash Filter๋ฅผ ํ†ต๊ณผํ•ด ElasticSearch๋กœ Output์„ ์ถœ๋ ฅํ•œ๋‹ค.

img
โ–ฒ ๋ฐ์ดํ„ฐ ํ๋ฆ„ ํŒŒ์ดํ”„๋ผ์ธ

DB์— ์กด์žฌํ•˜๋Š” ํŒŒ์ผ๋“ค์„ Logstash๋ฅผ ํ†ตํ•ด ์ „์ฒ˜๋ฆฌํ•˜์—ฌ ElasticSearch์— ์ „๋‹ฌํ•˜๋Š” ๊ณผ์ •์˜

ํŒŒ์ดํ”„๋ผ์ธ์„ ์ง„ํ–‰ํ•˜๊ณ , ์ตœ์ข…์ ์œผ๋กœ DB์˜ ๋ฐ์ดํ„ฐ๋ฅผ Kibana๋ฅผ ํ†ตํ•ด ์‹œ๊ฐํ™”ํ•  ์ˆ˜ ์žˆ๋‹ค.


# 2. Logstash ์„ค์น˜ํ•˜๊ธฐ

Elastic ํ™ˆํŽ˜์ด์ง€์— Logstash ๋‹ค์šด๋กœ๋“œ (opens new window) ํŽ˜์ด์ง€์—์„œ ๋‹ค์šด๋กœ๋“œ ํ•  ์ˆ˜ ์žˆ๋‹ค.

ํ˜„์žฌ(20.08.25) ์ตœ์‹ ๋ฒ„์ „์ธ 7.9.0๋ฅผ ๋‹ค์šด๋กœ๋“œ ๋ฐ›๊ฒ ๋‹ค.


# 3. ๊ฐ„๋‹จํ•œ ํŒŒ์ดํ”„๋ผ์ธ ์‹ค์Šตํ•˜๊ธฐ

ํ‚ค๋ณด๋“œ๋กœ input์„ ๋ฐ›๊ณ  ๋ชจ๋‹ˆํ„ฐ์— ์ถœ๋ ฅํ•˜๋Š” ์ด๋ฒคํŠธ๋ฅผ ๋งŒ๋“ค์–ด๋ณด์ž.

Logstash Reference(7.9) (opens new window) Getting Started with Logstash์— ์žˆ๋Š” ์‹ค์Šต ์˜ˆ์ œ์ด๋‹ค.

๋‹ค์šด๋กœ๋“œ ๋ฐ›์€ ๊ฒฝ๋กœ์—์„œ (ex /d/development/logstash-7.9.0)

$ bin/logstash -e 'input { stdin { } } output { stdout {} }'

๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜๊ณ  Hello wolrd๋ฅผ input์œผ๋กœ ์ž…๋ ฅํ•ด๋ณด์ž.

Hello world
{
          "host" => "DESKTOP-75DDGMG",
    "@timestamp" => 2020-08-26T01:29:39.383Z,
       "message" => "Hello world",
      "@version" => "1"
}

๋‹ค์Œ๊ณผ ๊ฐ™์ด ํ…Œ์ŠคํŠธ๋ฅผ ์™„๋ฃŒํ•  ์ˆ˜ ์žˆ๋‹ค.

Ctrl+C๋ฅผ ํ†ตํ•ด Logstash ๋ฅผ ์ข…๋ฃŒ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค.


Last Updated: 6/18/2023, 2:13:15 PM