Code Monkey home page Code Monkey logo

elk-stack's Introduction

ELK Stack

ELK 스택을 이용한 웹 어플리케이션 모니터링 시스템

  • Elasticsearch: 검색 엔진 및 NoSQL 데이터베이스
  • Logstash: 로그 데이터 파이프라인
  • Kibana: 데이터 시각화 인터페이스

1. Architecture

  • Django 프레임워크 사용
  • Filebeat 사용하여 Logstash로 로그 데이터 전송

1.2 RDB

  • PostgreSQL 12.7 (1GB RAM / 1 vCPU / 40GB SSD)

1.3 ELK Cluster

  • Docker-Compose 로 ELK 스택을 한 인스턴스에 구성
    • 각 컨테이너마다 메모리 1GB씩 할당

2. Structure

$> git clone https://github.com/miintto/elk-stack.git
$> cd elk-stack
$> tree
.
├── docker-compose.yml  # Service 정의
├── elasticsearch       # Elastirsearch
│   ├── Dockerfile
│   └── config
│       └── elasticsearch.yml
├── kibana              # Kibana
│   ├── Dockerfile
│   └── config
│       └── kibana.yml
└── logstash            # Logstash
    ├── Dockerfile
    ├── config
    │   └── logstash.yml
    └── pipeline
        └── logstash.conf

3. Quick Start

3.1 Requirement

  • Docker: 20.10.7
  • Docker-Compose: 2.2.3

3.1 Set Env

.env 파일을 생성하여 설정할 환경 변수를 입력합니다.

$> cp .env.example .env
$> vim .env

ELK_VERSION=1.7.1

ELASTIC_USERNAME=elastic
ELASTIC_PASSWORD=....

3.2 Check config files

설정한 환경 변수들이 제대로 세팅되었는지 확인합니다.

$> docker-compose config

networks:
  elastic:
    driver: bridge
services:
  elasticsearch:
    build:
...

3.3 Run

$> docker-compose up -d

3.4 Check running processes

$> docker ps

CONTAINER ID   IMAGE                     COMMAND                  CREATED          ...
cde0ed296b44   elk-stack_logstash        "/usr/local/bin/dock…"   30 minutes ago   ...
d938664e87bc   elk-stack_kibana          "/bin/tini -- /usr/l…"   30 minutes ago   ...
285ac83fbe91   elk-stack_elasticsearch   "/bin/tini -- /usr/l…"   30 minutes ago   ...

3.5 Access to Kibana

http://<서버 IP 혹은 host>:5601 로 접속하여 설정한 아이디와 비밀번호로 로그인할 수 있습니다.

4. Extra settings

4.1 Filebeat agent

Logstash 서버로 로그를 보내주는 filebeat는 간단히 다음과 같이 구성할 수 있습니다.

# filebeat.yml
filebeat.inputs:
  - type: filestream
    id: django-was-log
    paths:
      - /project/log/path/*.log
output.logstash:
  hosts: [ '${LOGSTASH_HOST}:5044' ]

Filebeat 더 알아보기

elk-stack's People

Contributors

miintto avatar

Watchers

 avatar

elk-stack's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.