본문 바로가기
운영체제 및 플랫폼/Linux(리눅스)

[Elastic] ELK 스택 설치 및 설정 가이드

by upself 2024. 7. 8.
728x90
OS : Rocky Linux 9.0

 

Elasticsearch: 데이터 저장 및 검색.
Elastic Agent: 데이터 수집.
Kibana: 데이터 시각화.

 

  • Elasticsearch 저장소 설정 및 설치
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
cat <<EOF | sudo tee /etc/yum.repos.d/elasticsearch.repo
[elasticsearch]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF

sudo yum install elasticsearch
  • Elasticsearch 시작 및 활성화
sudo systemctl enable elasticsearch
sudo systemctl start elasticsearch
  • Kibana 저장소 설정 및 설치
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
cat <<EOF | sudo tee /etc/yum.repos.d/kibana.repo
[kibana]
name=Kibana repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF

sudo yum install kibana
  • Kibana 시작 및 활성화
sudo systemctl enable kibana
sudo systemctl start kibana
  • Elastic Agent 설치
curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-7.13.2-linux-x86_64.tar.gz
tar xzvf elastic-agent-7.13.2-linux-x86_64.tar.gz
cd elastic-agent-7.13.2-linux-x86_64
sudo ./elastic-agent install

 

  • Elastic Agent 설정 파일 편집 ( /etc/elastic-agent/elastic-agent.yml )
Do you want to continue? [Y/n]: Y 입력
Do you want to enroll this Agent into Fleet? [Y/n]: n 입력
outputs:
  default:
    type: elasticsearch
    hosts: ["http://localhost:9200"]
    username: "your_elasticsearch_username"
    password: "your_elasticsearch_password"

inputs:
  - type: logfile
    id: my-logs
    enabled: true
    streams:
      - paths:
          - /mnt/nas/logs/*.log
        parsers:
          - ndjson:
              keys_under_root: true
              overwrite_keys: true

 


  • Elastic Agent 로그 확인
sudo journalctl -u elastic-agent -f
  • Elasticsearch 데이터 확인
curl -X GET "localhost:9200/_cat/indices?v"

 
 
 

https://www.elastic.co/kr/

 

Elastic — The Search AI Company

Elastic Search AI Platform으로 인사이트와 성과를 강화하세요. 인사이트 도출 시간을 단축할 수 있도록 설계된 엔터프라이즈 솔루션으로 데이터를 살펴보고 중요한 답을 찾으세요. 지금 Elastic을 사용

www.elastic.co

 

반응형