最近实时的项目有个需求,就是要查看集群中各个节点下面跑的项目的Log。于是想到了用Nginx将log目录暴露出来集成到现有的监控平台中去。
nginx的安装配置在前面的博客中有提到过,这里记录下如何配置访问log目录。
1 首先,设置权限
配置需要访问的log目录有权限
chmod -R /.../...
- 1
在nginx.conf文件中,添加或覆盖下面一行
user root;
- 1
2 配置server节点
server {
listen 64001;
server_name beta3.hadoop.feidai.com;
charset utf-8;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
autoindex on;
}
location /feidai-kafka-kudu/bin/slog {
root /root;
autoindex on;
}
location /feidai-canal-kafka/bin/slog {
root /root;
autoindex on;
}
......
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
其中添加了两个location节点,配置autoindex on;使其能展示目录。
在location节点里面配置alas会把指定路径当作文件路径,
而配置root会把指定路径拼接到文件路径后,再进行访问。
这里使用root配置。
访问实例:http://beta3.hadoop.feidai.com:64001/feidai-kafka-kudu/bin/slog/
整合到监控平台的效果如下图
本文暂时没有评论,来添加一个吧(●'◡'●)