Notice
Recent Posts
Recent Comments
Link
코알못
elastic search 명령어 본문
728x90
# 로그 건수 확인
GET servicelog-2022.02.20/_count
{
"query": {
"match_all": {}
}
}
{
"count" : 12,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
}
}
# 로그 데이터별 건수 확인 (group by message.keyword)
GET servicelog-2022.02.20/_search
{
"size": 0,
"aggs": {
"item": {
"terms": {
"field": "message.keyword"
}
}
}
}
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 12,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"item" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "{'name':'kafka'}",
"doc_count" : 2
},
{
"key" : "{'name':'logstash'}",
"doc_count" : 2
},
{
"key" : "{'name':'LeeHoSeong'}",
"doc_count" : 1
},
{
"key" : "{'name':'LeeNow'}",
"doc_count" : 1
},
{
"key" : "{'name':'ParkHyunJun'}",
"doc_count" : 1
},
{
"key" : "{'name':'hongYooLee'}",
"doc_count" : 1
},
{
"key" : "{'name':'horororo'}",
"doc_count" : 1
},
{
"key" : "{'name':'nanigore'}",
"doc_count" : 1
},
{
"key" : "{'name':'test'}",
"doc_count" : 1
},
{
"key" : "{'name':'thewayhj'}",
"doc_count" : 1
}
]
}
}
}
# 로그 유니크 건수
# - size : 0은 집계만 보겠다는 의미
# - aggs : 집계 사용 하겠다.
# - type_count : 집계 명칭으로 원하는 명칭을 사용하면 됩니다.
# - cardinality.field : 메세지의 값으로 집계를 하겠다.
# - cardinality.precision_threshold : es 의 집계 카운트는 대략적인 것으로 해당 수치를 올리면 메모리를
# 많이 차지 하지만 정확도는 올라간다. max : 40000 /default : 3000
POST servicelog-2022.02.20/_search
{
"size": 0,
"aggs": {
"type_count": {
"cardinality": {
"field": "message.keyword",
"precision_threshold": 40000
}
}
}
}
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 12,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"type_count" : {
"value" : 10
}
}
}
# 제거
delete servicelog-2022.02.20
- 이미지 출처 : https://ko.m.wikipedia.org/wiki/%ED%8C%8C%EC%9D%BC:Elasticsearch_logo.svg
728x90
'BIG DATA' 카테고리의 다른 글
[AWS] 로그수집 - logstash 큐 타입별 데이터 누락이 어느정도 발생할까? (0) | 2022.02.21 |
---|---|
[로그수집] logstash 큐 타입에 따라 어떤 차이가 있을까? (0) | 2022.02.20 |
[로그 수집] logstash 장애시 이슈 없을까? (0) | 2022.02.14 |
[로그 수집] 파이프 라인을 만들어 보자! (0) | 2022.02.13 |
[AWS] EMR(hadoop) - Glue 메타 스토어 (HIVE, SPARK) (0) | 2022.02.01 |
Comments