{"message": "2021-12-09 11:34:28.279|INFO|605c643e29e4|BIN--Python|192.168.1.1"}
//区切り文字として|を使用し(縦線はエスケープが必要です)、messageからtime、loglevel、taskId、ProcessName、ipフィールドを抽出します。ext_sepstr("message","time,loglevel,taskId,ProcessName,ip",sep="\\|")//messageを破棄します。fields_drop("message")
{"ProcessName":"BIN--Python","ip":"192.168.1.1","loglevel":"INFO","taskId":"605c643e29e4","time":"2021-12-09 11:34:28.279"}
{"regex": "2021-12-02 14:33:35.022 [1] INFO org.apache.Load - Response:status: 200, resp msg: OK, resp content: { \\"TxnId\\": 58322, \\"Label\\": \\"flink_connector_20211202_1de749d8c80015a8\\", \\"Status\\": \\"Success\\", \\"Message\\": \\"OK\\", \\"TotalRows\\": 1, \\"LoadedRows\\": 1, \\"FilteredRows\\": 0, \\"CommitAndPublishTimeMs\\": 16}"}
//カンマを区切り文字として使用し、ログを3つの部分に分割します。ext_sepstr("regex", "f1, f2, f3", sep=",")//f3フィールドのみを保持します:つまりresp content:およびそれ以降の文字です。fields_drop("regex","f1","f2")//コロンを使用してf3フィールド値を分割し、{}と括弧内の文字のみを保持して、resp_contentフィールドに保存します。このフィールドはjsonであり、flinkが返すメッセージパケットです。ext_sepstr("f3", "f1,resp_content", sep=":")fields_drop("f1","f3")//resp_contentフィールドを構造化します。ext_json("resp_content", prefix="")//元のフィールドを破棄します。fields_drop("resp_content")
{"CommitAndPublishTimeMs":"16","FilteredRows":"0","Label":"flink_connector_20211202_1de749d8c80015a8","LoadedRows":"1","Message":"OK","Status":"Success","TotalRows":"1","TxnId":"58322"}
フィードバック