2024년 5월 22일 수요일

ingest pipeline - 4th

ingest pipeline 추가. (v8.13.0)
PUT _ingest/pipeline/test-pipeline
{
  "processors": [
    {
      "dissect": {
        "field": "message",
        "pattern": "%{timestamp} %{+timestamp} %{} %{method} %{url} %{param} %{} %{} %{clientip} %{user_agent} %{} %{status} %{}"
      },
      "convert": {
        "field": "status",
        "type": "integer"
      },
      "convert": {
        "field": "clientip",
        "type": "ip"
      }
    }
  ]
}

convert processssor 중복 사용이 안 된다고?
{
  "error": {
    "root_cause": [
      {
        "type": "x_content_parse_exception",
        "reason": """[12:16] Duplicate field 'convert'
 at [Source: (byte[])"{
  "processors": [
    {
      "dissect": {
        "field": "message",
        "pattern": "%{timestamp} %{+timestamp} %{} %{method} %{url} %{param} %{} %{} %{clientip} %{user_agent} %{} %{status} %{}"
      },
      "convert": {
        "field": "status",
        "type": "integer"
      },
      "convert": {
        "field": "clientip",
        "type": "ip"
      }
    }
  ]
}
"; line: 12, column: 16]"""
      }
    ],
    "type": "x_content_parse_exception",
    "reason": """[12:16] Duplicate field 'convert'
 at [Source: (byte[])"{
  "processors": [
    {
      "dissect": {
        "field": "message",
        "pattern": "%{timestamp} %{+timestamp} %{} %{method} %{url} %{param} %{} %{} %{clientip} %{user_agent} %{} %{status} %{}"
      },
      "convert": {
        "field": "status",
        "type": "integer"
      },
      "convert": {
        "field": "clientip",
        "type": "ip"
      }
    }
  ]
}
"; line: 12, column: 16]""",
    "caused_by": {
      "type": "json_parse_exception",
      "reason": """Duplicate field 'convert'
 at [Source: (byte[])"{
  "processors": [
    {
      "dissect": {
        "field": "message",
        "pattern": "%{timestamp} %{+timestamp} %{} %{method} %{url} %{param} %{} %{} %{clientip} %{user_agent} %{} %{status} %{}"
      },
      "convert": {
        "field": "status",
        "type": "integer"
      },
      "convert": {
        "field": "clientip",
        "type": "ip"
      }
    }
  ]
}
"; line: 12, column: 16]"""
    }
  },
  "status": 400
}

convert processssor 하나만 사용하면 정상 등록된다.


그런데 등록된 프로세서 내역을 보면 프리뷰에 보이던 convert processssor가 안 보이네?


일단 실행.
output {
 elasticsearch {
  hosts => "192.168.56.1"
  pipeline => "test-pipeline"
  index => "test"
 }
}

IP 필드 생성 확인. convert processssor가 정상 동작했다는 얘기. 


status 필드를 숫자형으로 바꿔주는 convert processssor 추가.


이번엔 clientip 필드를 IP형으로 바꿔주는 convert processssor가 프리뷰에서 사라짐(..)


하지만 실행해보면 두 프로세서 모두 잘 동작했음을 알 수 있다.


Dev console과 키바나 UI가 충돌하는 모양. 키바나 UI만 사용하면 정상 동작한다.



댓글 없음:

댓글 쓰기

크리에이티브 커먼즈 라이선스