Get the App
SLTechnology News&Howtos  ›  Servers  › 

Obtain nginx log after ELK

Shulou Source: shulou.com Published: 2022-06-02 07:24:08 10月03日 Update

Elk obtains nginx log information through filebeat

Kibana-Infrastructure-View installation instructions-all-nginx logs

Download and install Filebeat

Curl-L-O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.1.1-darwin-x86_64.tar.gztar xzvf filebeat-7.1.1-darwin-x86_64.tar.gzcd filebeat-7.1.1-darwin-x86_64/

Edit configuration

Modify the filebeat.yml to set the connection information:

Output.elasticsearch: hosts: ["] # ip:9200 username:" elastic "# user password can not be entered password:"setup.kibana: host:"# ip:5601

Where is the user's password? the URL of Elasticsearch is the URL of Kibana. Elastic

Enable and configure the Nginx module

In the installation directory, run:

. / filebeat modules enable nginx vim / etc/filebeat/modules.d/nginx.yml

Modify the settings in the modules.d/nginx.yml file, remove comments and add nginx log path

Var.paths: ["/ var/log/nginx/access.log"] var.paths: ["/ var/log/nginx/error.log"]

Start Filebeat

The setup command loads the Kibana dashboard. If you have already set up the dashboard, ignore this command.

. / filebeat setup./filebeat-e

Firewall on exception or off

Finally, it is tested in kibana, and the nginx log information can be obtained if the test is successful.

Tags: Logs information meters commands passwords users dashboards detection configuration success but not infrastructure files modules comments directories facilities paths firewalls Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Microsoft Apple vpn Docker