Is it possible to use stdout as a fluentd source to capture specific logs for write to elasticsearch?

末鹿安然 提交于 2019-12-05 19:03:15

Yes, you could use fluentd's exec input plugin to launch your apps and capture their stdout. Note this means fluentd would be in charge of launching your application which may not be desirable - in that case if the application already writes to log file you can set fluentd up to tail that file, or if your application logs go to something like syslog you can feed off of that. If you are okay with modifying the application you could also have the application write the logs to fluentd using unix sockets or TCP/UDP messages or by posting logs to an HTTP endpoint. See Input Plugin Overview for more details and examples of different options for input.

Fluentd can further filter those logs for just the custom audit logs. This could be accomplished in several ways, based on log contents or other log entry properties or some combination. Additionally, there are additional plugins that can tally certain log entries and only emit after some thresholds are met. Note that you may not even need to parse anything if you are able to tag the audit messages from the start, but if and how to do this will differ upon the input plugins used.

For sending logs to Elasticsearch you can use uken/fluent-plugin-elasticsearch's output plugin using index_name to control the specific index.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!