我有以下日志文件作为示例,并希望在logz.io中的一行中查看 JSON 。我使用了几种配置。最后,我在 Filebeat 中使用了以下配置。但是,我仍然单独看到文本文件中的每一行。如果你能指导我,我会很高兴。
文件节拍配置
filebeat.inputs:
- type: log
enabled: true
paths:
- /tmp/*.log
multiline.type: pattern
multiline.pattern: '%{TIMESTAMP_ISO8601}'
multiline.negate: true
multiline.match: after
日志文件
2021-05-07T11:11:31.8298765+02:00 0HM8GHNH0KK9V:00000002 [INF] Request starting HTTP/1.1 GET http://11.11.11.11/swagger/index.html - - (ca22a1cb)
2021-05-07T11:11:31.8302819+02:00 0HM8GHNH0KK9V:00000002 [INF] Request finished HTTP/1.1 GET http://11.11.11.11/swagger/index.html - - - 200 - text/html;charset=utf-8 0.4099ms (791a596a)
2021-05-07T11:11:38.1371767+02:00 0HM8GHNH0KKA0:00000002 [DBG] ###DATA_REQUEST_888888###{
"operation": "new_business",
"policy": {
"originalContractStartTimestamp": 1620165600000,
"originalContractEndTimestamp": 1651701600000,
"effectiveContractEndTimestamp": 1651701600000,
"fees": [],
"documents": [],
"invoices": [],
"productName": "personal-auto",
"createdTimestamp": 1620377486896,
"updatedTimestamp": 1620378697551,
"cancellation": null,
"depositAccount": null,
"issuedTimestamp": null,
"paymentScheduleName": "annually",
"OriginalContractStart": "2021-05-04T22:00:00Z",
"OriginalContractEnd": "2022-05-04T22:00:00Z",
"EffectiveContractEnd": "2022-05-04T22:00:00Z",
"Created": "2021-05-07T08:51:26.896Z",
"Updated": "2021-05-07T09:11:37.551Z",
"Issued": "0001-01-01T00:00:00"
}
"endorsementLocator": null
} (0596056d)
2021-05-07T11:11:38.2993754+02:00 0HM8GHNH0KKA0:00000002 [INF] Already stored pricing version is used, calculation date 05/07/2021 08:51:47 (79d888c3)
2021-05-07T11:11:38.3039358+02:00 0HM8GHNH0KKA0:00000002 [INF] Already stored pricing version is used, calculation date 05/07/2021 08:51:47 (79d888c3)
2021-05-07T11:11:38.3093491+02:00 0HM8GHNH0KKA0:00000002 [INF] Already stored pricing version is used, calculation date 05/07/2021 08:51:47 (79d888c3)
2021-05-07T11:11:38.3143367+02:00 0HM8GHNH0KKA0:00000002 [INF] Already stored pricing version is used, calculation date 05/07/2021 08:51:47 (79d888c3)
来自 logz.io 的日志