1. Kibana

1) DevTools를 이용하여 Elasticsearch에 Index 생성

PUT _template/kafkastudy-gkelog-transaction
{
  "order": 0,
  "index_patterns": ["kafkastudy-gkelog-transaction"],
  "settings": {
    "index":{
      "lifecycle":{
        "name":"gkelog_policy"
      },
      "mapping":{
        "total_fields":{
          "limit":"30"
        }
      }
    },
    "refresh_interval": "5s",
    "number_of_shards": 1,
    "query":{
      "default_field":["transactionid"]
    },
    "number_of_replicas": 0
  },
  "mappings": {
    "dynamic":false,
    "date_detection": false,
    "properties": {
      "transactionid" : {
        "type": "keyword"
      },
      "userId" : {
        "type": "keyword"
      },
      "message" : {
        "type": "text"
      },
      "currentTime" :{
        "type": "date"
      }
    }
   },
   "aliases": {}
}

2) kafkastudy-gkelog-transaction Index에 대한 전체 Document 조회

명령어

GET /kafkastudy-gkelog-transaction/_search?pretty

결과

{
  "took": 1,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 3,
      "relation": "eq"
    },
    "max_score": 1,
    "hits": [
      {
        "_index": "kafkastudy-gkelog-transaction",
        "_id": "60b09bcb-c855-4d30-85cc-dcb8ca3ed1b5",
        "_score": 1,
        "_source": {
          "@timestamp": "2023-05-22T05:07:41.053Z",
          "userId": "seojeonghyeon0630",
          "currentTime": "2023-05-22T14:07:36.691077397",
          "messageContent": "hello",
          "transactionid": "60b09bcb-c855-4d30-85cc-dcb8ca3ed1b5",
          "@version": "1"
        }
      },
      {
        "_index": "kafkastudy-gkelog-transaction",
        "_id": "7c4d3a5b-1b89-4a8b-8728-39587690fe2a",
        "_score": 1,
        "_source": {
          "@timestamp": "2023-05-22T05:07:41.054Z",
          "userId": "seojeonghyeon0630",
          "currentTime": "2023-05-22T14:07:38.134866342",
          "messageContent": "hello",
          "transactionid": "7c4d3a5b-1b89-4a8b-8728-39587690fe2a",
          "@version": "1"
        }
      },
      {
        "_index": "kafkastudy-gkelog-transaction",
        "_id": "70e0f099-7858-4225-9b2e-ae8e60286cc9",
        "_score": 1,
        "_source": {
          "@timestamp": "2023-05-22T05:08:56.059Z",
          "userId": "seojeonghyeon0630",
          "currentTime": "2023-05-22T14:08:52.666337707",
          "messageContent": "hello",
          "transactionid": "70e0f099-7858-4225-9b2e-ae8e60286cc9",
          "@version": "1"
        }
      }
    ]
  }
}

마치며

Helm을 이용하여 ELK+Kafka+Filebeat를 설치해보며 많은 다양한 것들을 배울 수 있었다.

업무에서 이미 ELK에 대해 다루고 있었지만 VM에서 유지되는 상태였기 때문에 Cluster 환경에서 구축해볼 기회가 없었는데, Helm에서 어떤 방식으로 구축을 지원하는지 틀을 잡을 수 있는 기회를 얻었다.

이후에도 Kafka-manager나 Filebeat를 이동시켜 실제 운영에서 쓰이는 환경과 유사하게 만들어 보는 것도 좋을 것으로 여겨진다.

 

+ Recent posts