0

所以我试图从csv中提取数据,但似乎我失败了

我已经试过了,但似乎我总是弄错了

这是我的消息数据

"message" : """42307;"FX2CHTPEKAFB";"PACKING CYL COP JUPITER Z         FUBORU";"PCS";"";"";"";"";;"""""

这是我的模式

"patterns": ["""%{DATA:id_product};"%{DATA:code_product}";"%{DATA:name_product}";"%{DATA:satuan_product}";"%{DATA:merek_vehicle}";"%{DATA:jenis_vehicle}";"%{DATA:merek_product}";"%{DATA:part_number}";%{DATA:weight:float};"%{DATA:unit_weight}""""]"patterns": ["""%{DATA:id_product};"%{DATA:code_product}";"%{DATA:name_product}";"%{DATA:satuan_product}";"%{DATA:merek_vehicle}";"%{DATA:jenis_vehicle}";"%{DATA:merek_product}";"%{DATA:part_number}";%{DATA:weight:float};"%{DATA:unit_weight}""""]

我的结果

"docs" : [
{
  "error" : {
    "root_cause" : [
      {
        "type" : "exception",
        "reason" : """java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Provided Grok expressions do not match field value: [42305;"FX4PER000501I";"PER DPN F-50       DH-0005-01          48110-87624-01 MITS";"PCS";"DAIHATSU";"";"INDOSPRING";"";;]""",
        "header" : {
          "processor_type" : "grok"
        }
      }
    ],
    "type" : "exception",
    "reason" : """java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Provided Grok expressions do not match field value: [42305;"FX4PER000501I";"PER DPN F-50       DH-0005-01          48110-87624-01 MITS";"PCS";"DAIHATSU";"";"INDOSPRING";"";;]""",
    "caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : """java.lang.IllegalArgumentException: Provided Grok expressions do not match field value: [42305;"FX4PER000501I";"PER DPN F-50       DH-0005-01          48110-87624-01 MITS";"PCS";"DAIHATSU";"";"INDOSPRING";"";;]""",
      "caused_by" : {
        "type" : "illegal_argument_exception",
        "reason" : """Provided Grok expressions do not match field value: [42305;"FX4PER000501I";"PER DPN F-50       DH-0005-01          48110-87624-01 MITS";"PCS";"DAIHATSU";"";"INDOSPRING";"";;]"""
      }
    },
    "header" : {
      "processor_type" : "grok"
    }
  }
4

1 回答 1

0

它不喜欢%{DATA:weight:float}

如果您删除:float,则给出:

%{DATA:id_product};"%{DATA:code_product}";"%{DATA:name_product}";"%{DATA:satuan_product}";"%{DATA:merek_vehicle}";"%{DATA:jenis_vehicle}";"%{DATA:merek_product}";"%{DATA:part_number}";%{DATA:weight};"%{DATA:unit_weight}

你会得到:

{
  "name_product": "PACKING CYL COP JUPITER Z         FUBORU",
  "jenis_vehicle": "",
  "satuan_product": "PCS",
  "weight": "",
  "id_product": "42307",
  "merek_vehicle": "",
  "code_product": "FX2CHTPEKAFB",
  "merek_product": "",
  "part_number": "",
  "unit_weight": ""
}
于 2019-04-15T12:24:19.887 回答