mirror of
https://github.com/netdata/netdata.git
synced 2025-04-22 04:31:08 +00:00

* spelling: activity Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: adding Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: addresses Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: administrators Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: alarm Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: alignment Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: analyzing Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: apcupsd Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: apply Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: around Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: associated Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: automatically Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: availability Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: background Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: bandwidth Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: berkeley Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: between Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: celsius Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: centos Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: certificate Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: cockroach Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: collectors Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: concatenation Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: configuration Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: configured Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: continuous Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: correctly Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: corresponding Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: cyberpower Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: daemon Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: dashboard Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: database Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: deactivating Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: dependencies Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: deployment Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: determine Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: downloading Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: either Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: electric Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: entity Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: entrant Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: enumerating Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: environment Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: equivalent Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: etsy Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: everything Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: examining Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: expectations Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: explicit Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: explicitly Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: finally Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: flexible Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: further Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: hddtemp Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: humidity Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: identify Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: importance Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: incoming Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: individual Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: initiate Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: installation Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: integration Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: integrity Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: involuntary Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: issues Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: kernel Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: language Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: libwebsockets Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: lighttpd Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: maintained Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: meaningful Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: memory Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: metrics Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: miscellaneous Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: monitoring Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: monitors Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: monolithic Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: multi Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: multiplier Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: navigation Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: noisy Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: number Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: observing Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: omitted Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: orchestrator Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: overall Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: overridden Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: package Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: packages Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: packet Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: pages Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: parameter Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: parsable Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: percentage Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: perfect Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: phpfpm Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: platform Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: preferred Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: prioritize Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: probabilities Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: process Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: processes Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: program Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: qos Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: quick Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: raspberry Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: received Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: recvfile Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: red hat Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: relatively Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: reliability Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: repository Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: requested Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: requests Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: retrieved Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: scenarios Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: see all Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: supported Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: supports Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: temporary Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: tsdb Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: tutorial Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: updates Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: utilization Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: value Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: variables Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: visualize Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: voluntary Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: your Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
161 lines
6.4 KiB
Markdown
161 lines
6.4 KiB
Markdown
<!--
|
|
title: "Monitor Nginx or Apache web server log files with Netdata"
|
|
custom_edit_url: https://github.com/netdata/netdata/edit/master/docs/guides/collect-apache-nginx-web-logs.md
|
|
-->
|
|
|
|
# Monitor Nginx or Apache web server log files with Netdata
|
|
|
|
Log files have been a critical resource for developers and system administrators who want to understand the health and
|
|
performance of their web servers, and Netdata is taking important steps to make them even more valuable.
|
|
|
|
By parsing web server log files with Netdata, and seeing the volume of redirects, requests, or server errors over time,
|
|
you can better understand what's happening on your infrastructure. Too many bad requests? Maybe a recent deploy missed a
|
|
few small SVG icons. Too many requests? Time to batten down the hatches—it's a DDoS.
|
|
|
|
Netdata has been capable of monitoring web log files for quite some time, thanks for the [weblog python.d
|
|
module](/collectors/python.d.plugin/web_log/README.md), but we recently refactored this module in Go, and that effort
|
|
comes with a ton of improvements.
|
|
|
|
You can now use the [LTSV log format](http://ltsv.org/), track TLS and cipher usage, and the whole parser is faster than
|
|
ever. In one test on a system with SSD storage, the collector consistently parsed the logs for 200,000 requests in
|
|
200ms, using ~30% of a single core. To learn more about these improvements, see our [v1.19 release post](https://blog.netdata.cloud/posts/release-1.19/).
|
|
|
|
The [go.d plugin](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/weblog/) is currently compatible
|
|
with [Nginx](https://nginx.org/en/) and [Apache](https://httpd.apache.org/).
|
|
|
|
This guide will walk you through using the new Go-based web log collector to turn the logs these web servers
|
|
constantly write to into real-time insights into your infrastructure.
|
|
|
|
## Set up your web servers
|
|
|
|
As with all data sources, Netdata can auto-detect Nginx or Apache servers if you installed them using their standard
|
|
installation procedures.
|
|
|
|
Almost all web server installations will need _no_ configuration to start collecting metrics. As long as your web server
|
|
has readable access log file, you can configure the web log plugin to access and parse it.
|
|
|
|
## Configure the web log collector
|
|
|
|
To use the Go version of this plugin, you need to explicitly enable it, and disable the deprecated Python version.
|
|
First, open `python.d.conf`:
|
|
|
|
```bash
|
|
cd /etc/netdata/ # Replace with your Netdata configuration directory, if not /etc/netdata/
|
|
./edit-config python.d.conf
|
|
```
|
|
|
|
Find the `web_log` line, uncomment it, and set it to `web_log: no`. Next, open the `go.d.conf` file for editing.
|
|
|
|
```bash
|
|
./edit-config go.d.conf
|
|
```
|
|
|
|
Find the `web_log` line again, uncomment it, and set it to `web_log: yes`.
|
|
|
|
Finally, restart Netdata with `service netdata restart`, or the appropriate method for your system. You should see
|
|
metrics in your Netdata dashboard!
|
|
|
|

|
|
|
|
If you don't see web log charts, or **web log nginx**/**web log apache** menus on the right-hand side of your dashboard,
|
|
continue reading for other configuration options.
|
|
|
|
## Custom configuration of the web log collector
|
|
|
|
The web log collector's default configuration comes with a few example jobs that should cover most Linux distributions
|
|
and their default locations for log files:
|
|
|
|
```yaml
|
|
# [ JOBS ]
|
|
jobs:
|
|
# NGINX
|
|
# debian, arch
|
|
- name: nginx
|
|
path: /var/log/nginx/access.log
|
|
|
|
# gentoo
|
|
- name: nginx
|
|
path: /var/log/nginx/localhost.access_log
|
|
|
|
# APACHE
|
|
# debian
|
|
- name: apache
|
|
path: /var/log/apache2/access.log
|
|
|
|
# gentoo
|
|
- name: apache
|
|
path: /var/log/apache2/access_log
|
|
|
|
# arch
|
|
- name: apache
|
|
path: /var/log/httpd/access_log
|
|
|
|
# debian
|
|
- name: apache_vhosts
|
|
path: /var/log/apache2/other_vhosts_access.log
|
|
|
|
# GUNICORN
|
|
- name: gunicorn
|
|
path: /var/log/gunicorn/access.log
|
|
|
|
- name: gunicorn
|
|
path: /var/log/gunicorn/gunicorn-access.log
|
|
```
|
|
|
|
However, if your log files were not auto-detected, it might be because they are in a different location. Try the default
|
|
`web_log.conf` file.
|
|
|
|
```bash
|
|
./edit-config go.d/web_log.conf
|
|
```
|
|
|
|
To create a new custom configuration, you need to set the `path` parameter to point to your web server's access log
|
|
file. You can give it a `name` as well, and set the `log_type` to `auto`.
|
|
|
|
```yaml
|
|
jobs:
|
|
- name: example
|
|
path: /path/to/file.log
|
|
log_type: auto
|
|
```
|
|
|
|
Restart Netdata with `service netdata restart` or the appropriate method for your system. Netdata should pick up your
|
|
web server's access log and begin showing real-time charts!
|
|
|
|
### Custom log formats and fields
|
|
|
|
The web log collector is capable of parsing custom Nginx and Apache log formats and presenting them as charts, but we'll
|
|
leave that topic for a separate guide.
|
|
|
|
We do have [extensive
|
|
documentation](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/weblog/#custom-log-format) on how
|
|
to build custom parsing for Nginx and Apache logs.
|
|
|
|
## Tweak web log collector alarms
|
|
|
|
Over time, we've created some default alarms for web log monitoring. These alarms are designed to work only when your
|
|
web server is receiving more than 120 requests per minute. Otherwise, there's simply not enough data to make conclusions
|
|
about what is "too few" or "too many."
|
|
|
|
- [web log alarms](https://raw.githubusercontent.com/netdata/netdata/master/health/health.d/web_log.conf).
|
|
|
|
You can also edit this file directly with `edit-config`:
|
|
|
|
```bash
|
|
./edit-config health.d/weblog.conf
|
|
```
|
|
|
|
For more information about editing the defaults or writing new alarm entities, see our [health monitoring
|
|
documentation](/health/README.md).
|
|
|
|
## What's next?
|
|
|
|
Now that you have web log collection up and running, we recommend you take a look at the documentation for our
|
|
[python.d](/collectors/python.d.plugin/web_log/README.md) for some ideas of how you can turn these rather "boring" logs
|
|
into powerful real-time tools for keeping your servers happy.
|
|
|
|
Don't forget to give GitHub user [Wing924](https://github.com/Wing924) a big 👍 for his hard work in starting up the Go
|
|
refactoring effort.
|
|
|
|
[](<>)
|