Skip to content

Commit aa36ce2

Browse files
committed
fix structure of the document
1 parent f2e3b72 commit aa36ce2

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

site/content/how-to/monitoring/troubleshooting.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ Logs from the NGINX Gateway Fabric control plane and data plane can contain info
8585
To see logs for Control plane container:
8686

8787
```shell
88-
kubectl -n nginx-gateway logs <ngf-pod-name> -c nginx-gateway
88+
kubectl -n nginx-gateway logs <ngf-pod-name> -c nginx-gateway
8989
```
9090

9191
To see logs for Data plane container:
9292

9393
```shell
94-
kubectl -n nginx-gateway logs <ngf-pod-name> -c nginx
94+
kubectl -n nginx-gateway logs <ngf-pod-name> -c nginx
9595
```
9696

9797
##### Error Logs
@@ -101,7 +101,7 @@ To see error logs for control plane and data plane containers:
101101
For _nginx-gateway_ container, you can `grep` for the word `error` or change the log level to `error` by following steps in [Modify log levels](#modify-log-levels). Once you have modified log levels, you can `grep` for the word `debug` to check debug logs for further investigation.
102102

103103
```shell
104-
kubectl -n nginx-gateway logs <ngf-pod-name> -c nginx-gateway | grep error
104+
kubectl -n nginx-gateway logs <ngf-pod-name> -c nginx-gateway | grep error
105105
```
106106

107107
For example, an error message when telemetry is not enabled for NGINX Plus installations:
@@ -112,10 +112,10 @@ Defaulted container "nginx-gateway" out of: nginx-gateway, nginx
112112
{"level":"error","ts":"2024-06-13T18:22:16Z","logger":"usageReporter","msg":"Usage reporting must be enabled when using NGINX Plus; redeploy with usage reporting enabled","error":"usage reporting not enabled","stacktrace":"github.com/nginxinc/nginx-gateway-fabric/internal/mode/static.createUsageWarningJob.func1\n\tgithub.com/nginxinc/nginx-gateway-fabric/internal/mode/static/manager.go:616\nk8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext.func1\n\tk8s.io/apimachinery@v0.30.1/pkg/util/wait/backoff.go:259\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1\n\tk8s.io/apimachinery@v0.30.1/pkg/util/wait/backoff.go:226\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil\n\tk8s.io/apimachinery@v0.30.1/pkg/util/wait/backoff.go:227\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\tk8s.io/apimachinery@v0.30.1/pkg/util/wait/backoff.go:204\nk8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext\n\tk8s.io/apimachinery@v0.30.1/pkg/util/wait/backoff.go:259\ngithub.com/nginxinc/nginx-gateway-fabric/internal/framework/runnables.(*CronJob).Start\n\tgithub.com/nginxinc/nginx-gateway-fabric/internal/framework/runnables/cronjob.go:53\nsigs.k8s.io/controller-runtime/pkg/manager.(*runnableGroup).reconcile.func1\n\tsigs.k8s.io/controller-runtime@v0.18.4/pkg/manager/runnable_group.go:226"}
113113
```
114114

115-
For _nginx_ container you can `grep` for various [error](https://nginx.org/en/docs/ngx_core_module.html#error_log) log levels and they are all logged in brackets `[emerg]`:
115+
For _nginx_ container you can `grep` for various [error](https://nginx.org/en/docs/ngx_core_module.html#error_log) log levels. They are logged with the`[emerg]` tag:
116116

117117
```shell
118-
kubectl -n nginx-gateway logs <ngf-pod-name> -c nginx | grep emerg
118+
kubectl -n nginx-gateway logs <ngf-pod-name> -c nginx | grep emerg
119119
```
120120

121121
For example, if a variable is too long, NGINX may display such an error message:
@@ -127,8 +127,8 @@ kubectl logs -n nginx-gateway ngf-nginx-gateway-fabric-bb8598998-jwk2m -c nginx
127127

128128
##### Access Logs
129129

130-
NGINX access logs are files that record all requests processed by the NGINX server. These logs provide detailed information about each request, which can be useful for troubleshooting, and analyzing web traffic.
131-
To view the access logs, get shell access to your NGINX container using the [steps](#get-shell-access-to-nginx-container). The access logs are located in the file `/var/log/nginx/access.log` in the NGINX container and present in logs for _nginx_ container.
130+
NGINX access logs record all requests processed by the NGINX server. These logs provide detailed information about each request, which can be useful for troubleshooting and analyzing web traffic.
131+
Access logs can be viewed with the above method of using `kubectl logs`, or by viewing the access log file directly. To do that, get shell access to your NGINX container using these [steps](#get-shell-access-to-nginx-container). The access logs are located in the file `/var/log/nginx/access.log` in the NGINX container.
132132

133133
You can see logs for a crashed or killed container by adding the `-p` flag to the above commands.
134134

@@ -154,7 +154,7 @@ server {
154154
}
155155
```
156156

157-
Once HTTPRoute with path matches and rules are defined, the nginx.conf is updated accordingly to determine which location block will manage incoming requests. To demonstrate how `nginx.conf` is changed, let's create some resources:
157+
Once a HTTPRoute with path matches and rules are defined, the nginx.conf is updated accordingly to determine which location block will manage incoming requests. To demonstrate how `nginx.conf` is changed, let's create some resources:
158158

159159
1. A Gateway with single listener on port 80. The hostname specified is `*.example.com`, so all incoming requests matching that wildcard is accepted by this Gateway.
160160
2. A simple `coffee` application with hostname `cafe.example.com` and referenced to the Gateway we created.
@@ -291,23 +291,23 @@ In such situations, it's advisable to review the logs of both NGINX and NGINX Ga
291291
#### Access the N+ Dashboard
292292

293293
If you have NGINX Gateway Fabric installed with NGINX Plus, you can access the N+ dashboard at `http://localhost:8080/dashboard.html`.
294-
Note that, the port number i.e `8080` matches the port number you have port-forwarded your NGINX Gateway Fabric Pod. For further [details]({{< relref "dashboard.md" >}})
294+
Note that, the port number i.e `8080` matches the port number you have port-forwarded your NGINX Gateway Fabric Pod. For further details, see the [dashboard guide]({{< relref "dashboard.md" >}})
295295

296296
### Common Errors
297297

298298
{{< bootstrap-table "table table-striped table-bordered" >}}
299-
| Problem Area | Symptom | Troubleshooting Method | Common Cause |
300-
|------------------------------|----------------------------------------|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------|
301-
| Startup | NGINX Gateway Fabric fails to start. | Check logs for _nginx_ and _nginx-gateway_ container. | Missing TLS key and cert for SSL servers. |
302-
| Resources not configured | Status missing on resources. | Check referenced resources. | Referenced resources not belong to Gateway Fabric. |
303-
| NGINX errors | Reload failures on NGINX | Fix permissions for control plane. | Security context not configured. |
304-
| Usage reporting | Errors logs related to usage reporting | Enable usage reporting. Refer to this [Usage Reporting]({{< relref "installation/usage-reporting.md" >}}) | Usage reporting disabled. |
299+
| Problem Area | Symptom | Troubleshooting Method | Common Cause |
300+
|------------------------------|----------------------------------------|---------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------|
301+
| Startup | NGINX Gateway Fabric fails to start. | Check logs for _nginx_ and _nginx-gateway_ container. | Missing TLS key and cert for SSL servers. |
302+
| Resources not configured | Status missing on resources. | Check referenced resources. | Referenced resources do not belong to NGINX Gateway Fabric. |
303+
| NGINX errors | Reload failures on NGINX | Fix permissions for control plane. | Security context not configured. |
304+
| Usage reporting | Errors logs related to usage reporting | Enable usage reporting. Refer to this [Usage Reporting]({{< relref "installation/usage-reporting.md" >}}) | Usage reporting disabled. |
305305
{{< /bootstrap-table >}}
306306

307307
##### NGINX fails to reload
308308

309309
NGINX reload errors can occur for various reasons, including syntax errors in configuration files, permission issues, and more. To determine if NGINX has failed to reload, check logs for your _nginx-gateway_ and _nginx_ containers.
310-
You will see the following error in the _nginx-gateway_ logs `failed to reload NGINX:` followed by the reason for the failure. Similarly, error logs in _nginx_ container start with `emerg`. For example, `2024/06/12 14:25:11 [emerg] 12345#0: open() "/var/run/nginx.pid" failed (13: Permission denied)` shows a critical error, such as a permission problem preventing NGINX from accessing necessary files.
310+
You will see the following error in the _nginx-gateway_ logs: `failed to reload NGINX:`, followed by the reason for the failure. Similarly, error logs in _nginx_ container start with `emerg`. For example, `2024/06/12 14:25:11 [emerg] 12345#0: open() "/var/run/nginx.pid" failed (13: Permission denied)` shows a critical error, such as a permission problem preventing NGINX from accessing necessary files.
311311

312312
To debug why your reload has failed, start with verifying the syntax of your configuration files by opening a shell in the NGINX container following these [steps](#get-shell-access-to-nginx-container) and running `nginx -T`. If there are errors in your configuration file, the reload will fail and specify the reason for it.
313313

0 commit comments

Comments
 (0)