Hi everyone!
@Update:
Head to first comment to see my current problem
I try to load JSON formatted logs from log file into elasticsearch. Everything works OK, but I have those json.message, json.@timestamp, json.whatever keys stored in elasticsearch. From what I've read the parameter:
json.keys_under_root: true
Handles this problem well, so I'd see normal fields. But when I add it to the yml file and restart filebeat service, filebeat can't ship logs to elasticsearch anymore. My config:
filebeat:
prospectors:
-
paths:
- /tmp/logs/logs.log
json:
message_key: message
keys_under_root: true
overwrite_keys: true
output:
elasticsearch:
hosts: ["localhost:9200"]
index: "logstash-%{+yyyy.MM.dd}"
Without keys_under_root everything works properly. Elasticsearch and Kibana are on docker containers and in version 5.2.0. Filebeat is 5.2.2.
Another thing I'd like to know is:
Can I get rid of all those Beats.Name, Beats.Hostname, Type fields? I can see, they are defined in filebeat.template.json and I'd like to get rid of them, but when I delete them and restart service, filebeat stops to ship logs to ES too.
Could You please help me with those 2 matters or point me to right direction?
Edit:
To clarify, here is the example log:
What I want to achieve is to get rid of "json" prefix on custom fields and, if possible, I'd like to remove offset, source, type, input_type and Beats.* fields as I don't need them.
Greetings, Wojtek