Elasticsearch 살펴보기 6탄 - CAT API

bradley·2022년 6월 14일
1

ELK

목록 보기
8/8

보통 Elasticsearch API들의 결과는 JSON 포맷으로 보여진다. 그러나 JSON은 항상 읽기 쉽지는 않다. CAT API는 출력된 결과 포맷을 읽고 이해하는데 좀 더 쉽게 해준다. 다른 용도로 server에 사용되는 CAT API에는 다양한 parameter들이 사용된다. 예를 들어 V는 출력을 상세하게 보여준다.

Verbose

verbose 출력은 cat command의 결과를 보기 좋게 해준다.

Command Example

GET /_cat/indices?v

정상 출력

health status index                             uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   .triggered_watches                Rp9C0tscSTy1tcP8l5Wa1w   1   0          4         2608    222.8kb        222.8kb
green  open   .monitoring-logstash-7-2022.05.27 iS_wE6q-SWuOWaLNK5_8xQ   1   0      22756            0      2.3mb          2.3mb
yellow open   logstash-2022.06.08-000001        nXknuZXdQlSPK8rgNs_Ywg   1   1         34            0     39.1kb         39.1kb
green  open   .monitoring-logstash-7-2022.05.26 YuzOaf83SuS_khj1NnM8CQ   1   0       3231            0    375.2kb        375.2kb
...

Headers

header를 뜻하는 h는 command에 언급된 columns만 표시할 때 사용한다.

Command Example

GET /_cat/nodes?h=ip,port

정상 출력

127.0.0.1 9300

Sort

sort command는 query에 있는 특정 column에 의해 table을 정렬할 수 있도록 하는 query string을 받아들인다. 기본 정렬은 오름차순(asc)이지만 :desc를 추가해 정렬을 변경할 수 있다.

Command Exmaple

GET /_cat/templates?v&s=order:desc,index_patterns

정상 출력

name                            index_patterns               order      version
.slm-history                    [.slm-history-1*]            2147483647 
.triggered_watches              [.triggered_watches*]        2147483647 
.watch-history-10               [.watcher-history-10*]       2147483647 
.watches                        [.watches*]                  2147483647 
ilm-history                     [ilm-history-1*]             2147483647 
.logstash-management            [.logstash]                  0          
.management-beats               [.management-beats]          0          70000
.ml-anomalies-                  [.ml-anomalies-*]            0          7060299
.ml-config                      [.ml-config]                 0          7060299

Count

전체 cluster에 있는 document의 총 수를 count한다.

Command Example

GET /_cat/count?v

정상 출력

epoch      timestamp count
1655189654 06:54:14  4510512
profile
데이터 엔지니어링에 관심이 많은 홀로 삽질하는 느림보

0개의 댓글