Hi,
I'm trying to send a JSON Log over UDP, so filebeat forwards it to the ElasticSearch.
The thing is, I can't get it to decode the JSON payload
I also tried with a \n and a \n\n to no luck
{
"@timestamp": "2018-07-18T21:11:57.266Z",
"@metadata": {
"beat": "filebeat",
"type": "doc",
"version": "6.3.1",
"truncated": false
},
"input": {
"type": "udp"
},
"prospector": {
"type": "udp"
},
"beat": {
"name": "dad20104e72c",
"hostname": "dad20104e72c",
"version": "6.3.1",
"timezone": "+00:00"
},
"host": {
"name": "dad20104e72c",
"architecture": "x86_64",
"os": {
"family": "debian",
"codename": "xenial",
"platform": "ubuntu",
"version": "16.04.4 LTS (Xenial Xerus)"
},
"id": "b987bfc2295c4e82afddb796793d7ac1",
"containerized": true
},
"source": "127.0.0.1:40783",
"message": "{\"inner\":\"John\",\"outer\":30}"
}
Python Script
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(bytes('{"inner":"John","outer":30}','utf-8'), ('127.0.0.1', 7070))
Netcat Debug
nc -ul 127.0.0.1 -p 7070
{"inner":"John","outer":30}
Filebeat Version
filebeat version 6.3.1 (amd64), libbeat 6.3.1 [ed42bb85e72ae58cc09748dc1825159713e0ffd4 built 2018-06-29 21:09:35 +0000 UTC]
Python 3 Version
Python 3.6.5 (default, May 3 2018, 10:08:28)
[GCC 5.4.0 20160609] on linux
Filebeat .yml
filebeat.prospectors:
- type: udp
max_message_size: 10KiB
host: "localhost:7070"
enabled: true
processors:
- add_locale: ~
- add_host_metadata: ~
- decode_json_fields:
fields: ["inner", "outer"]
output.console:
pretty: true
logging.level: debug