StoryCode

'전체 글'에 해당되는 글 550건

  1. Logstach 설치
  2. KIBANA.샘플데이터 로드
  3. 표준 ANSI SQL MODE (Strict Mode) 사용 On/OFF

Logstach 설치

Elastic Search
반응형

[참조] https://www.elastic.co/guide/kr/logstash/current/installing-logstash.html

 

1) Download & Extract

https://artifacts.elastic.co/downloads/logstash/logstash-7.0.1.tar.gz

 

> sudo su -

> cd /usr/local

> tar zxvf logstash-7.0.1.tar.gz

 

2) Logstash 파이프라인을 생성 테스트 실행테스트

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

위 문장을 실행하면 대기모드가 되는데, "hello world" 입력한다.

그럼 결과가 아래와 같이 나타난다.

{
    "@timestamp" => 2019-05-16T23:54:07.736Z,
          "host" => "myhost",
      "@version" => "1",
       "message" => "hello world"
}

Ctrl + D 를 눌러 종료한다.

 

3) 아파치로그 파싱해보기 + FileBeat 을 이용해 Log를 Logstash 로 보내기

  FileBeat 은 log 를 발송하는 Client 측이고, Beats input은 서버측이다.

  Beats input 은 Beats 를 기본 골격으로 하는 FileBeat, PacketBeat, MetricBeat 등을 모두 받아들일 수 있다.

  그리고 이를 Logstash 로 전송한다.

      샘플 데이타 다운로드 : https://download.elastic.co/demos/logstash/gettingstarted/logstash-tutorial.log.gz 

      FileBeat : https://www.elastic.co/kr/downloads/beats/filebeat

                   ( https://github.com/elastic/beats/tree/master/filebeat )

      Beats input : https://www.elastic.co/guide/en/logstash/5.4/plugins-inputs-beats.html

  

  3.1.Download FileBeat 에서 https://www.elastic.co/kr/downloads/beats/filebeat

       https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.0.1-linux-x86_64.tar.gz

  

  3.2.FileBeat 설치

 https://www.elastic.co/guide/en/logstash/5.4/advanced-pipeline.html#configuring-filebeat

 

반응형

'Elastic Search' 카테고리의 다른 글

용어  (0) 2023.08.28
[I] FireBeat 설치  (0) 2019.05.20
KIBANA.샘플데이터 로드  (0) 2019.05.09
KIBANA 설치  (0) 2019.04.30
검색 실행  (0) 2019.04.30

KIBANA.샘플데이터 로드

Elastic Search
반응형

[참조.한글] https://www.elastic.co/guide/kr/kibana/current/tutorial-load-dataset.html

[참조.영문]https://www.elastic.co/guide/en/kibana/current/tutorial-load-dataset.html#_set_up_mappings 

한글과영문은 동일.

한글 매뉴얼은 가끔 오류가 나니 영문 참조하는 걸 권유 (Ex> shakespeare mapping )

 

1)

curl -O https://download.elastic.co/demos/kibana/gettingstarted/7.x/shakespeare.json
curl -O https://download.elastic.co/demos/kibana/gettingstarted/7.x/accounts.zip
curl -O https://download.elastic.co/demos/kibana/gettingstarted/7.x/logs.jsonl.gz

 

 

2)

unzip accounts.zip

unzip logs.jsonl.gz

 

3) 

curl -X PUT "localhost:9200/shakespeare" -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "properties": {
    "speaker": {"type": "keyword"},
    "play_name": {"type": "keyword"},
    "line_id": {"type": "integer"},
    "speech_number": {"type": "integer"}
    }
  }
}
'

 

curl -X PUT "localhost:9200/logstash-2015.05.18" -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "properties": {
      "geo": {
        "properties": {
          "coordinates": {
            "type": "geo_point"
          }
        }
      }
    }
  }
}
'

 

curl -X PUT "localhost:9200/logstash-2015.05.19" -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "properties": {
      "geo": {
        "properties": {
          "coordinates": {
            "type": "geo_point"
          }
        }
      }
    }
  }
}
'

 

curl -X PUT "localhost:9200/logstash-2015.05.20" -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "properties": {
      "geo": {
        "properties": {
          "coordinates": {
            "type": "geo_point"
          }
        }
      }
    }
  }
}
'

 

4) 

curl -H 'Content-Type: application/x-ndjson' -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary "@./download/accounts.json"

 

curl -H 'Content-Type: application/x-ndjson' -XPOST 'localhost:9200/shakespeare/_bulk?pretty' --data-binary "@./download/shakespeare.json"

 

curl -H 'Content-Type: application/x-ndjson' -XPOST 'localhost:9200/_bulk?pretty' --data-binary "@./download/logs.jsonl"

 

 

5) Shakespeare Index Pattern 생성

순서 1) Kibana 5601 port 접속 > 왼쪽 메뉴 Management > Kibana 서브 메뉴> 아래 Index Pattern 클릭

순서 2) Create index pattern 클릭

순서 3) Step 1 of 2: Define index pattern 에서 shakes* 입력후 다음

순서 4) Step 2 of 2: Configure settings 에서 Create index pattern 클릭

 

6) bank Index Pattern 생성

순서 1) Kibana 5601 port 접속 > 왼쪽 메뉴 Management > Kibana 서브 메뉴> 아래 Index Pattern 클릭

순서 2) Create index pattern 클릭

순서 3) Step 1 of 2: Define index pattern 에서 ba* 입력후 다음

순서 4) Step 2 of 2: Configure settings 에서 Create index pattern 클릭

 

7) Logstash Index Pattern 생성

순서 1) Kibana 5601 port 접속 > 왼쪽 메뉴 Management > Kibana 서브 메뉴> 아래 Index Pattern 클릭

순서 2) Create index pattern 클릭

순서 3) Step 1 of 2: Define index pattern 에서 logstash* 입력후 다음

순서 4) @timestamp 선택

순서 5) Step 2 of 2: Configure settings 에서 Create index pattern 클릭

 

8) Kibana 에서 데이터 확인하기.

순서 1) Kibana > 왼쪽 메뉴 Discover 선택

순서 2) 좌측 Filter 아래에서 ba* 선택

순서 3) Filter 에 "account_number<100 AND balance>47500" 입력후 업데이트 클릭하면 결과가 나타난다.

          Filter Bar 우측 "Lucene" 을 클릭하면 On/ Off 나타나는데, Toggle 하면 KQL 로 바꿔야 한다.

* Available Field 에서 add 하면, 원하는 컬럼만 볼 수 있다.

 

9) Kibana 에서 bank 데이터 Visualize 하기.

참고) Visualize 선택시, 우측에 나타나는 목록은 Visaulize 저장된 목록이다.

순서 1) Kibana > 왼쪽 메뉴 Visualize 선택 > 우측 상단 + 클릭 > pie 선택

순서 2) Index Pattern 는 ba* 선택.

순서 3) 왼쪽 중간에 있는 Bucket 메뉴에서 Split Slices 선택.

순서 4) Range 는 Aggregation 선택.
순서 5) Field 는 balance.
순서 6) Range 는 0~999, 1000~2999, 3000~6999, 7000~14999, 15000~30999, 31000~50000 을 입력 후, ▶ (Apply changes) 클릭

순서 7) Save 메뉴 클릭해서 Pie 로 저장.

 

 

10) Kibana 에서 Shakespear 데이터 Visualize 하기.

순서 1) Kibana > 왼쪽 메뉴 Visualize 선택 > 우측 상단 + 클릭 > Vertical bar 선택

순서 2) Index Pattern 는 shake* 선택.

순서 3) 왼쪽 중간에 있는 Metrics 에서, Y-Axis 클릭.

순서 4) Aggregation 을 Unique Count 로 변경, Field 는 Speaker 로 선택. Custom Lable 은 "Speaking Parts"

순서 5) 왼쪽 아래에 있는 Buckets 에서 X-Axis 클릭.
순서 6) Aggregation 을 Terms 으로 설정 및 Field 를 play_name 로 설정.
순서 7) Order by 는 alphabetically 로 설정, Order 는 Ascending으로 설정.
순서 8) custom label 은 "Play Name" 으로 설정.

순서 9) ▶ (Apply changes) 클릭
순서 10) Save 메뉴 클릭해서 Bar 로 저장.

 

11) Kibana 에서 logstach 데이터 Visualize 하기.

순서 1) Kibana > 왼쪽 메뉴 Visualize 선택 > 우측 상단 + 클릭 > Coordinate map 선택

순서 2) Index Pattern 는 logstash* 선택.

순서 3) 상단 Filter 바 우측의 "타임 Picker 바"에서 Absolute / 20150518 ~ 20150520 선택

순서 4) 왼쪽 아래에 있는 Buckets 에서 Geo Coordinates 클릭.

순서 5) Aggregation 을 Geohash  로 설정 및 Field 를 geo.coordinates 선택.
순서 6) 
순서 7) 
순서 8) 

순서 9) ▶ (Apply changes) 클릭
순서 10) Save 메뉴 클릭해서 Bar 로 저장.

 

12) Kibana 에서 

반응형

'Elastic Search' 카테고리의 다른 글

[I] FireBeat 설치  (0) 2019.05.20
Logstach 설치  (0) 2019.05.17
KIBANA 설치  (0) 2019.04.30
검색 실행  (0) 2019.04.30
데이터 탐색.샘플데이터 집합 로드  (0) 2019.04.29

표준 ANSI SQL MODE (Strict Mode) 사용 On/OFF

Database 관리/MySQL
반응형

1) 확인

mysql -u root -p -e "SHOW VARIABLES LIKE 'sql_mode';"

 

2) OFF

mysql -u root -p -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';" 

mysql -u root -p -e "SELECT @@GLOBAL.sql_mode;"

 

3) OFF vi my.cnf

[mysqld]

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

반응형

'Database 관리 > MySQL' 카테고리의 다른 글

실시간 SQL LOG 남기는 방법  (0) 2023.09.18
2023-226.MySQL,Architecture,아키텍처.우기  (0) 2023.08.06
콘솔.Tag자동완성  (0) 2023.07.31
Plan.용어.설명  (0) 2023.03.22
save as CSV  (0) 2022.01.07