This page contains queries that you can use with
[Logs Explorer](https://docs.cloud.google.com/logging/docs/view/logs-explorer-interface.md.txt).
You can use these queries to retrieve, view, and analyze log data. These logs
can contain valuable historical data that isn't captured by `nomos bugreport`
when the operator or reconciler Pods are restarted.

To find the most important logs, sort the issues by severity and then adjust
the timestamp to control the time window.

| Query/filter name | Expression | Notes |
|---|---|---|
| Check the reconciler-manager logs | ```sql resource.type="k8s_container" resource.labels.project_id="PROJECT_ID" resource.labels.cluster_name="CLUSTER_NAME" resource.labels.namespace_name="config-management-system" resource.labels.container_name="reconciler-manager" timestamp >= "START_TIME" timestamp <= "STOP_TIME" ``` |   |
| Check the reconciler logs for a namespace repository | ```sql resource.type="k8s_container" resource.labels.project_id="PROJECT_ID" resource.labels.cluster_name="CLUSTER_NAME" resource.labels.namespace_name="config-management-system" resource.labels.container_name="reconciler" resource.labels.pod_name:"ns-reconciler-NAMESPACE" timestamp >= "START_TIME" timestamp <= "STOP_TIME" ``` | To view the `git-sync` logs, change `resource.laels.container_name` to `git-sync`. To view the root reconciler logs, change `resource.labels.pod_name` to `root-reconciler`. |
| Check if a cluster was upgraded in a period | ```sql resource.type="gke_cluster" resource.labels.project_id="PROJECT_ID" resource.labels.cluster_name="CLUSTER_NAME" resource.labels.location="LOCATION" timestamp >= "START_TIME" timestamp <= "STOP_TIME" ``` | If the cluster you queried wasn't upgraded, the result is empty. |
| Check if reconciler Pods failed to start | ```sql resource.type="k8s_pod" resource.labels.project_id="PROJECT_ID" resource.labels.cluster_name="CLUSTER_NAME" resource.labels.location="LOCATION" resource.labels.pod_name:"ns-reconciler-NAMESPACE" timestamp >= "START_TIME" timestamp <= "STOP_TIME" ``` | If you see an error for Config Sync related Pods, that means those Pods weren't able to start at the associated timestamp. |
| Check the operation of a ConfigMap | ```sql resource.type="k8s_cluster" resource.labels.project_id="PROJECT_ID" resource.labels.cluster_name="CLUSTER_NAME" resource.labels.location="LOCATION" protoPayload.methodName:"io.k8s.core.v1.configmaps" protoPayload.resourceName:"core/v1/namespaces/config-management-system/configmaps/ns-reconciler-cap-logging-service" timestamp >= "START_TIME" timestamp <= "STOP_TIME" ``` |   |
| Check the operation of a RepoSync | ```sql resource.type="k8s_cluster" resource.labels.project_id="PROJECT_ID" resource.labels.cluster_name="CLUSTER_NAME" resource.labels.location="LOCATION" protoPayload.methodName:"reposyncs" protoPayload.resourceName:"namespaces/cap-logging-service/reposyncs" timestamp >= "START_TIME" timestamp <= "STOP_TIME" ``` |   |
| List all Git revisions synced by `git-sync` | ```sql resource.type="k8s_container" resource.labels.project_id="PROJECT_ID" resource.labels.location="LOCATION" resource.labels.cluster_name="CLUSTER_NAME" resource.labels.namespace_name="config-management-system" resource.labels.pod_name:"git-importer-" severity>=DEFAULT "adding worktree" ``` |   |

Replace the following:

- <var translate="no">`PROJECT_ID`</var>: Your project ID.
- <var translate="no">`CLUSTER_NAME`</var>: The name of the cluster that you want to query.
- <var translate="no">`START_TIME`</var>: Set the time that you want to start collecting logs. You must use the following format when writing a query with a timestamp: YYYY-MM-DDT00:00:00Z.
- <var translate="no">`STOP_TIME`</var>: Set the time that you want to stop collecting logs. You must use the following format when writing a query with a timestamp: YYYY-MM-DDT00:00:00Z.
- <var translate="no">`NAMESPACE`</var>: The namespace that you created your namespace repository in.
- <var translate="no">`LOCATION`</var>: The location that you created your cluster in.