十二月 2021

本篇介绍如何通过filebeat来收集nginx日志1、filebeat启用nginx模块linux:./filebeatmodulesenablenginxwindows:filebeat.exemodulesenablenginx2、配置nginx日志参数修改modules.d/nginx.yml文件-module:nginxaccess:enabled:truevar.paths:["D:/knight/nginx-1.17.0/logs/*"]error:enabled:truevar.paths:["D:/knight/nginx-1.17.0/logs/*"]说明:windows环...
1、访问官网下载安装文件https://www.elastic.co/cn/beats/filebeat2、修改配置文件修改配置文件filebeat.yml,配置elasticsearch和kibana访问地址output.elasticsearch:hosts:["localhost:9200"]username:"elastic"password:"changeme"setup.kibana:host:"localhost:5601"3、启动命令linux:sudo./filebeat-e-cfilebeat.ymlwindows:filebeat.exe-e-cfilebeat.yml
1、访问官网地址下载安装文件Kibana:数据的探索、可视化和分析|Elastic2、修改配置文件打开config/kibana.yml文件,设置elasticsearch的访问地址elasticsearch.hosts:["http://localhost:9200"]3、启动命令linux:bin/kibanawindows:bin\kibana.bat说明:初次启动或硬件配置一般的话,启动命令执行后暂时无任何反应,大概需要等待5分钟左右才会启动成功,需耐心等待。4、验证是否启动成功打开浏览器访问http://localhost:5601,出现如下内容表示启动成功
1、访问官网进行下载安装文件https://www.elastic.co/cn/elasticsearch/2、启动命令linux:bin/elasticsearchwindows:bin\elasticsearch.bat3、验证是否启动成功curlhttp://localhost:9200返回如下内容表示启动成功
启动命令:filebeat.exe-e-cfilebeat.yml
1、修改nginx配置文件在location模块下添加如下配置获取代理前的用户IPproxy_set_headerX-real-ip$remote_addr;修改后配置参考如下:location/{try_files$uri$uri//index.html;proxy_set_headerX-real-ip$remote_addr;}2、java端获取用户IPpublicstaticStringgetIpAddress(){HttpServletRequestrequest=getRequest();Stringip=request....
解决方法:1、关闭window的防火墙简单粗暴,可以用来验证问题,但不太安全,确定是防火墙的问题后,可以通过方法二设置入站规则开放端口。2、开通响应端口入站规则