2.启动容器
使用docker内置的日志驱动把日志传出给fluentd
docker run -dit -p 8080:80\
-v /test/nginx.conf:/etc/nginx/nginx.conf \
--log-driver=fluentd \
--log-opt fluentd-address=localhost:24224 \
--log-opt tag="docker.``.`Name`" \
nginx
#测试docker访问正常
[root@test-node3 ~]# curl localhost:8080
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
安装kibana
下载kibana
wget https://artifacts.elastic.co/downloads/kibana/kibana-5.2.2-linux-x86_64.tar.gz
[root@salt-node1 src]# tar zxf kibana-5.2.2-linux-x86_64.tar.gz
[root@salt-node1 src]# mv kibana-5.2.2-linux-x86_64 /usr/local/kibana
[root@salt-node1 src]# cd /usr/local/kibana/
[root@salt-node1 kibana]# vim config/kibana.yml
server.host: "192.168.198.116"
elasticsearch.url: "http://localhost:9200"
启动kibana
[root@salt-node1 kibana]# ./bin/kibana
log [17:06:42.720] [info][status][plugin:kibana@5.2.2] Status changed from uninitialized to green - Ready
log [17:06:42.831] [info][status][plugin:elasticsearch@5.2.2] Status changed from uninitialized to yellow - Waiting for Elasticsearch
log [17:06:42.877] [info][status][plugin:console@5.2.2] Status changed from uninitialized to green - Ready
log [17:06:42.970] [info][status][plugin:elasticsearch@5.2.2] Status changed from yellow to green - Kibana index ready
log [17:06:43.551] [info][status][plugin:timelion@5.2.2] Status changed from uninitialized to green - Ready
log [17:06:43.559] [info][listening] Server running at http://192.168.198.116:5601
log [17:06:43.562] [info][status][ui settings] Status changed from uninitialized to green - Ready