这个教程展示了istio如何自定义日志格式,并且将其发送给fluent。Fluentd 是一个开源的日志收集器,支持多种数据输出并且有一个可插拔架构。Elasticsearch是一个流行的后端日志记录程序, Kibana 用于查看。

1.Fluentd/Elasticsearch/Kibana 安装

该栈包括 Fluentd,Elasticsearch 和 Kibana 在一个非生产集合 ServicesDeployments 在一个新的叫做loggingNamespace 中。

将下面的内容保存为 logging-stack.yaml.

 Expand source
 

运行命令创建资源:

kubectl apply -f logging-stack.yaml
运行命令看到如下输出:
 Expand source
 

可以运行命令 kubectl get pods -n logging o wide -watch 确定所有的Pod创建成功。

2.配置istio

现在有一个正在运行的 Fluentd 守护进程,请使用新的日志类型配置 Istio,并将这些日志发送到监听守护进程。

创建一个新的 YAML 文件来保存日志流的配置,Istio 将自动生成并收集。

将下面的内容保存为 fluentd-istio.yaml:

 Expand source
 

 

创建资源:

istioctl create -f fluentd-istio.yaml

预期的输出类似于:

Created config logentry/istio-system/newlog at revision 22374
Created config fluentd/istio-system/handler at revision 22375
Created config rule/istio-system/newlogtofluentd at revision 22376

可以运行命令 kubectl get pods -n logging o wide -watch 确定所有的Pod创建成功。

3.访问测试用例

http://192.168.181.99:32693/productpage

http://192.168.181.99:32693/portal/info

http://192.168.181.99:30022/python-sa/info

4.查看fluent ui

http://192.168.181.99:30601

posted on 2018-05-25 14:42  九重霄  阅读(605)  评论(0编辑  收藏  举报