2020년 9월 1일 화요일

Graylog fielddata=true 설정하라는 오류 관련

그레이로그 버전업 후 생긴 문제점

(2.0.3 -> 3.3.3)

message에 따라서 Aggregation을 하는데.. (파이차트 등.)


상위버전에서 message, full_message 항목에 대해서 index를 잡지 않는 상태가 되어 통계를 쓸수 없게 되었다.

fielddata를 true로 하라는 개떡 같은 메시지가 있었으나.


엘라스틱서치에 대한 설정이었으며


curl -X GET '설정IP:9200/_template/graylog-internal?pretty'

명령어로 내부에 설정된 것을 확인했을때.


아래 message에 fielddata:false가 되어 있음을 확인



curl -X GET '설정IP:9200/graylog_deflector/_mapping?pretty'

현재 매핑된녀석들을 볼수 있으며

message가 어찌되어있는지 확인을 해보면 좋음;



custom인덱스를 이용하기로 마음을 먹었고

curl -X PUT "설정IP:9200/_template/graylog-custom-mapping?pretty" -H 'Content-Type: application/json' -d'

{

  "template": "graylog_*",

  "mappings" : {

    "message" : {

      "properties" : {

        "message" : {

          "type" : "text",

          "analyzer" : "standard",

          "fielddata": true,

          "fields": {

            "keyword": { 

              "type": "keyword"

            }

          }

          }

        }

      }

    }

  }

}'


추가하였음;


curl -X GET '설정IP:9200/graylog_deflector/_mapping?pretty'

를 해보았는데.. 여전히 fielddata에 대한 부분이 설정이 안되어 있는 것을 확인


추가해도 안먹히는 이유는 기존인덱스에는 당연히 적용이 안되어있어서 여전히 표현이 안되는 것이고.

GraylogWeb에서 Indices -> default index set -> Maintenance -> Rotate active write index

하게 되면 graylog_* -> 다음것으로 바뀌게 되며 graylog_deflector했을때.. 내가 설정한 커스텀 값이 적용되는 것을 볼수 있으나.


여전히 검색할때 안먹히는 이유는 기존에 생성된 graylog_0 같은 인덱스에는.. 적용이 안되었기 때문임

그냥 기존것 가볍게 삭제.. -_-; 하고나서 잘됨.


입력했던 커스텀을 삭제하고 싶으면

curl -X DELETE "설정IP:9200/_template/graylog-custom-mapping?pretty"

이런것을 때리면 됨;


참고했던것

https://docs.graylog.org/en/3.3/pages/configuration/elasticsearch.html

https://blog.voidmainvoid.net/314