LogDNA NGINX Ingress Controller Template

📘

The Template Library documentation has moved

This topic is not up-to-date. View the latest documentation for the NGINX Ingress Controller Template.

The LogDNA NGINX Ingress Controller Template provides you better observability into your infrastructure with NGINX Ingress Controller (nginxinc/kubernetes-ingress) logs. The Template includes pre-configured views, boards, screens, and a logging format to get the most out of your logs. After configuring the Template, you can set up alerts on excessive HTTP 500's, graph response codes broken down by upstream service name, and more.

Interested in other LogDNA Templates? Browse the full Template Library here.

How do I configure the NGINX Template?

Start working with the NGINX Ingress Controller Template in 3 steps

  1. Click the "Configure Template" button above and sign into your LogDNA account.
  2. A file will be generated with your Template. Drag and drop the file where directed.
  3. See your new Views, Boards, and Screens in the LogDNA web application!

Afterwards, optionally modify the Template and add alerts to suit your needs.

📘

Surfacing Additional Metadata

To surface additional metadata in this Template such as upstream Kubernetes service name or response time, you'll need to set up our recommended logging format.

What is in the NGINX Ingress Controller Template?

The NGINX Ingress Controller Template consists of a collection of pre-configured views, boards, and screens. To learn more about these visibility tools and their specific use cases, click on the respective links above. Detailed below are the different insights provided by the NGINX Ingress Controller Template.

Views

  1. HTTP 2XX
  2. HTTP 5XX
  3. HTTP 404 Errors
  4. HTTP Forbidden/Unauthorized (401, 403)
  5. HTTP Server Errors
    • Includes 500's and NGINX error logs, if those error logs are using the default error log format.

Boards

  1. HTTP Response Codes and Errors
    • Breakdown by App, Host, Request (Path), Client IP, and Upstream Kubernetes Service
  2. 95th Percentile Response Times for Upstream and Total Time
  3. Traffic Volume with Total Bytes and Requests

Screens

  1. Web Analytics, such as traffic trends, most popular pages, and referrers
  2. Server Health, such as number of 500s by grouped by upstream service
  3. Web Server Security, such as top 401 and 403 errors by IP Address

NGINX Ingress Controller Log Format Configuration

To take full advantage of the the NGINX Ingress Controller Template with nginxinc/kubernetes-ingress, users should add our recommended custom log format. If you're using the community version (kubernetes/ingress-nginx) see the following section. The custom log format exposes additional NGINX variables such as upstream service name and response times to further aid in debugging your infrastructure. Without this custom log format, parts of the Template will not be populated with data.

See here for more details on configuring NGINX via a ConfigMap resource. Log formats that deviate from this format or the default Apache Common or Combined log format will lead to incorrect data being populated in this Template.

Recommended log format configuration:

log-format: 'verb="$request_method" request="$uri" response=$status clientip="$remote_addr" scheme="$scheme" bytes=$bytes_sent agent="$http_user_agent" referrer="$http_referer" request_time=$request_time upstream_response=$upstream_status upstream_response_time=$upstream_response_time upstream_service="$service" resource_name="$resource_name" resource_namespace="$resource_namespace" resource_type="$resource_type" http_host="$http_host" request_id="$request_id" time_date="$time_iso8601"'
log-format-escaping: 'json'

Example ConfigMap (you'll need to modify this depending on your NGINX Ingress Controller setup):

kind: ConfigMap
apiVersion: v1
metadata:
  name: nginx-config
  namespace: default
data:
  log-format: 'verb="$request_method" request="$uri" response=$status clientip="$remote_addr" scheme="$scheme" bytes=$bytes_sent agent="$http_user_agent" referrer="$http_referer" request_time=$request_time upstream_response=$upstream_status upstream_response_time=$upstream_response_time upstream_service="$service" resource_name="$resource_name" resource_namespace="$resource_namespace" resource_type="$resource_type" http_host="$http_host" request_id="$request_id" time_date="$time_iso8601"'
  log-format-escaping: 'json'

Using kubernetes/ingress-nginx

If you're not using the nginxinc/kubernetes-ingress but instead using the ingress version from kubernetes/ingress-nginx the out-of-the-box Template will still be compatible, but the extra Kubernetes metadata will not be parsed automatically so Template elements that require data like upstream service/response time will not be available.

To expose additional Kubernetes metadata to LogDNA, you can configure a custom ConfigMap and log format in a similar manner to the recommended log format above.

Unable To See Template Installation Instructions?

If you have an ad blocker enabled, you may not see the configuration tutorial provided. As a workaround, you can whitelist LogDNA in your ad blocker. Alternatively, you can install the Template by downloading the configuration file here. Afterwards, drag it into your import config settings and click "Import". You can find additional docs on importing configurations here.