# Logging and Monitoring

[CORTEX-meta](https://github.com/ResearchDataCom/cortex-meta) provides centralized monitoring and logging for all workloads running in the Kubernetes cluster. Monitoring metrics are available through Grafana, while application and infrastructure logs are collected and queried through Loki.

## Monitoring

[Access to Grafana](https://grafana.cluster.ibrst.org/dashboards) avails dashboards for monitoring the health and performance of the Kubernetes cluster and its workloads including CORTEX components.

### Obtaining Credentials
Username:
```text
admin
```

Retrieve the administrator password using:
```bash
kubectl -n monitoring get secret prometheus-grafana \
  -o jsonpath="{.data.admin-password}" | base64 -d
echo
```

After signing in, browse the available dashboards to view cluster metrics, resource utilization, workload health, and other operational insights.

## Logging

Centralized logs for all cluster workloads are collected by the CORTEX Meta Loki logging service.

1. Open [Grafana](https://grafana.cluster.ibrst.org/dashboards).
2. Navigate to **Explore**.
3. Select **Loki** as the data source.
4. Select a label, such as `namespace`, and choose the appropriate value.
5. Specify the time range for the logs you want to view.
6. Run the query to display the matching log entries.

You can further refine queries by selecting additional labels or using LogQL expressions to filter specific workloads, pods, or containers.
