How to Observe NGINX Controller with Loki?

How to Observe NGINX Controller with Loki?

Observability is a crucial aspect of managing and optimizing the performance of your applications. NGINX Controller, a powerful management solution for NGINX Plus, enables you to control, monitor, and troubleshoot your NGINX deployments efficiently. In this article, we will explore how to enhance observability by integrating NGINX Controller with Loki, a log aggregation system that is part of the Grafana ecosystem.


Before we delve into the integration process, make sure you have the following prerequisites in place:

  1. NGINX Controller installed and configured.
  2. Loki installed and accessible.
  3. Basic knowledge of NGINX and Grafana.

Integration Steps:

1. Install and Configure NGINX Controller Data Source in Grafana:

  • Open your Grafana dashboard.
  • Navigate to the "Gear" icon on the left sidebar and select "Data Sources."
  • Click on "Add your first data source" or "Add data source."
  • Search for "Loki" in the available plugins and select it.
  • Set the URL for your Loki instance and configure other relevant settings.

2. Enable NGINX Controller Logs:

  • Log in to your NGINX Controller.
  • Navigate to the "Settings" menu.
  • Select "Logging" and enable the NGINX Controller logs.
  • Configure log settings according to your preferences.

3. Configure Loki to Ingest NGINX Controller Logs:

  • Access your Loki configuration file (usually loki-config.yaml).
  • Add a new scrape_config to the targets section, specifying the NGINX Controller log path.
- job_name: 'nginx-controller'
- targets: ['localhost:3100'] # NGINX Controller log path

4. Verify Integration:

  • Restart Loki to apply the changes.
  • Go back to Grafana, create a new dashboard, and add a Loki panel.
  • Build queries using NGINX Controller labels and explore log data.

More Examples:

Query NGINX Controller Requests:

{job="nginx-controller", severity="info", log_stream="nginx-controller-access"}

Identify NGINX Controller Errors:

{job="nginx-controller", severity="error"}

By following these steps, you've successfully integrated NGINX Controller with Loki, enhancing your observability capabilities. Monitoring NGINX Controller logs in Grafana allows you to gain insights into application performance, troubleshoot issues, and optimize your NGINX deployments effectively.

Related Searches and Questions asked:

  • How to Optimize Your K8s Applications?
  • How to Observe NGINX Controller with Fluentd?
  • What is Kuberhealthy and How to Use it?
  • How to Autoscale in Kubernetes?
  • That's it for this topic, Hope this article is useful. Thanks for Visiting us.