Open shipilovds opened 5 years ago
Thank you for your report. It is very good report. :100: I'm glad to receive such detailed and no shortage information to reproduce this issue.
Sorry for my english. I'm not native speaker.
No problem. I'm also not a native speaker.
Your assuming log is the following style (ToString()-ed JSON object within log field)?
{"source":"stdout","log":"{\"level\":\"info\",\"ts\":1545751556.9878204,\"msg\":\"Started\",\"version\":\"HEAD\",\"build_date\":\"2018-12-12T14:31:50+0000\"}","container_name":"/w1"}
If not so, parser plugin does not work....
Yes, JSON field in kibana is as follows:
{
"_index": "logstash-2018.12.27",
"_type": "fluentd",
"_id": "xvkr72cBchWqobSTatzm",
"_version": 1,
"_score": null,
"_source": {
"container_name": "/my_container",
"source": "stderr",
"log": "{\"level\":\"info\",\"ts\":1545905775.6339545,\"msg\":\"Started\",\"version\":\"HEAD\",\"build_date\":\"2018-12-12T14:31:50+0000\"}",
"container_id": "f52c73fed5b2360d23b73d3c72d84cb6fefe0581996a01da9aa717c909c9ffd0",
"@timestamp": "2018-12-27T10:16:15.000000000+00:00"
},
...
}
Umm..., I guess that your json like log is not valid JSON....
How about using the following configuration?
<filter docker.**>
@type parser
@log_level debug
<parse>
@type multi_format
<pattern>
format json
</pattern>
<pattern>
format none
</pattern>
</parse>
key_name log
# reserve_data true
</filter>
Note that the above configuration needs to install https://github.com/repeatedly/fluent-plugin-multi-format-parser.
Umm..., I guess that your json like log is not valid JSON....
How about using the following configuration?
<filter docker.**> @type parser @log_level debug <parse> @type multi_format <pattern> format json </pattern> <pattern> format none </pattern> </parse> key_name log # reserve_data true </filter>
Note that the above configuration needs to install https://github.com/repeatedly/fluent-plugin-multi-format-parser.
Thank you! I will try this. About "not valid JSON": same logs being processed by logstash. Problem is not with validity, I think.
About "not valid JSON": same logs being processed by logstash. Problem is not with validity, I think.
Hmm.... Logstash uses Jackson JRuby binding, instead, our JSON deserializer is Yajl CRuby binding.
I have the same issue. Any update on this please?
+1
Any progress?
Sorry, guys. Project with this issue is closed some time ago, I didn`t make research after. I have nothing to say. If I meet such problem again - I will tell you.
Problem
json logs are not sent to ES after parser filter with json format.
I see the following messages in fluentd logs:
@log_level debug
enabled for elasticsearch pluginSteps to replicate
fluentd Dockerfile:
fluentd conf:
And service that echo json to stdout every N seconds with docker-compose file:
fluentd service and test_json are at the same network.
string with json:
Expected Behavior or What you need to ask
I want to see formatted logs in kibana (ES as storage). json log must be parsed and inserted in ROOT of _source. But instead I get an error and the log is not sent. If I remove
"msg":"Started",
from log string, I can't see any warning messages in fluentd log, but I can't see test logs in kibana too. I tried the different options and nothing helped :(( Documentation says it should work. Tell me if the above is not enough. P.S. Yes, I've seen this before: https://github.com/uken/fluent-plugin-elasticsearch/issues/320 And it doesn't help. Not the same. P.P.S. Sorry for my english. I'm not native speaker.Using Fluentd and ES plugin versions