Dear Community,
I would like to ask for an advice from you. I tried several methods to resolve this problem, but without a success.
My problem is: If a log entry (generated by my application) contains a colon (":"), filebeat breaks the value of the field (the field that contains the colon) and places it into seperate fields.
My filebeat.yml:
# ---------------------------- Log files Input ------------------------------
filebeat.inputs:
- type: log
enabled: true
json.keys_under_root: true
json.add_error_key: true
fields:
log_type: log_1
paths:
- path/to/log/file
# ---------------------------- Elasticsearch Output --------------------------
output:
elasticsearch:
hosts: ...
index: "%{[fields.log_type]}-%{+yyyy.MM.dd}"
# ---------------------------- Elasticsearch settings ------------------------
setup:
template:
name: "filebeat"
pattern: "*"
settings:
index.number_of_shards: 3
index.number_of_replicas: 1
ilm:
enabled: false
# ---------------------------- Processors ------------------------
processors:
- convert:
fields:
- from: "message"
to: "message"
type: "string"
Example log entry:
{"reqId":"t45rtdfg2zd9d74bbd4d6df100befa56","level":3,"time":"2024-06-26T08:44:03.234+00:00","remoteAddr":"xx.xx.xx.xx","user":"user1","app":"no app in context","method":"GET","url":"/index.php/one.jpg","message":"Requested file with invalid file id: -1","userAgent":"Mozilla/5.0 (Android) myApp/9.10.9","version":"9.10.9","data":[]}
or the same in a readable format:
{
"reqId":"t45rtdfg2zd9d74bbd4d6df100befa56",
"level":3,
"time":"2024-06-26T08:44:03.234+00:00",
"remoteAddr":"xx.xx.xx.xx",
"user":"user1",
"app":"no app in context",
"method":"GET",
"url":"/index.php/one.jpg",
"message":"Requested file with invalid file id: -1",
"userAgent":"Mozilla/5.0 (Android) myApp/9.10.9",
"version":"9.10.9",
"data":[]
}
The rest of the log entries (that does not contain a colon in the "message" field) are processed fine, and displayed in Kibana as it should.
Is there any method to escape the colons in that field or any other method to solve this problem?
I am using filebeat version 7.12, and Kibana 7.10.2.