Logging in Kibana

Learn how to explore Dispatch logs in Kibana

Dispatch Logging in Kibana

In Konvoy clusters, logs from Dispatch components and tasks can be found in Kibana.

Dispatch Component logs

The Dispatch CLI supports viewing the logs of the Pipelines Controller and Event Sink components.

To view the logs for pipelines-controller:

dispatch debug pipelines-controller

Log levels can be adjusted by setting them in Deployment object for controller. Controller output is structured by default and contains information about the pipeline launches.

To view the logs for event-sink (which is responsible for listening and processing git repo events):

dispatch debug event-sink

In order to view the dispatch component logs from Kibana UI, the query syntax can be used. For example:

  • To view event-sink pod logs:
{
  "query": {
    "match": {
      "kubernetes.labels.component": {
        "query": "event-sink",
        "type": "phrase"
      }
    }
  }
}
  • To view repository-controller pod logs:
{
  "query": {
    "match": {
      "kubernetes.labels.component": {
        "query": "repository-controller",
        "type": "phrase"
      }
    }
  }
}

Component logs can be filtered by the following labels:

Label Example Value
kubernetes.annotations.cni_projectcalico_org/podIP 192.168.70.76/32
kubernetes.container_name repository-controller
kubernetes.docker_id 8d2e195a4487afa384e47b98ec27fb7b2c12c3431980ed71563fd0802543508e
kubernetes.host ip-10-0-131-65.us-west-2.compute.internal
kubernetes.labels.component repository-controller
kubernetes.labels.pod-template-hash 6c6f675c9c
kubernetes.namespace_name dispatch
kubernetes.pod_id 0c84769a-25aa-497b-ba16-986969a694af
kubernetes.pod_name dispatch-kubeaddons-repository-controller-6c6f675c9c-dqs7n
message 2019-11-21T14:28:07.128Z DEBUG controller-runtime.controller Successfully Reconciled
stream stderr

Dispatch pipeline and task logs

Using the CLI to view the logs

In order to list the pipeline runs (active and completed):

dispatch ci list pipelineruns

To list the tasks in a pipeline run:

dispatch ci list tasks --pipelinerun  <pipelineRunId>

To view the logs of a task in a pipeline (or the pipeline logs if the pipeline is still active):

dispatch ci logs --task <taskName> --pipelinerun <pipelineRunId>

Using the Kibana dashboard to view the logs

You can also view the task logs for individual tasks and pipelines in Kibana. For example:

If you have CI configured for a repository called cicd-hello-world under the your-user GitHub account, and you create a PR from a branch called modify-readme, you can find the output generated by the build task using the following query:

{
  "query": {
    "bool": {
      "must": [
        {
          "match_all": {}
        },
        {
          "match_phrase": {
            "kubernetes.labels.build": {
              "query": "modify-readme"
            }
          }
        },
        {
          "match_phrase": {
            "kubernetes.labels.tekton_dev/task": {
              "query": "build"
            }
          }
        },
        {
          "match_phrase": {
            "kubernetes.labels.owner": {
              "query": "your-user"
            }
          }
        },
        {
          "match_phrase": {
            "kubernetes.labels.repository": {
              "query": "cicd-hello-world"
            }
          }
        }
      ]
    }
  }
}

Task logs are annotated with the following labels, which can all be queried in Kibana:

Label Example Value
kubernetes.annotations.cni_projectcalico_org/podIP 192.168.36.91/32
kubernetes.annotations.tasks test,build
kubernetes.annotations.tekton_dev/ready READY
kubernetes.container_name step-build-and-push
kubernetes.docker_id c7561c4dc2425703e743d02d33b04acd21da32c2c479ef2dfd10aa9a64e14c36
kubernetes.host ip-10-0-131-119.us-west-2.compute.internal
kubernetes.labels.app_kubernetes_io/managed-by tekton-pipelines
kubernetes.labels.build gpaul-patch-2
kubernetes.labels.commit ca9249b5645808228928b83269676f42f2b19d9
kubernetes.labels.owner gpaul
kubernetes.labels.repository cicd-hello-world
kubernetes.labels.tekton_dev/pipeline gpaul-cicd-hello-world-gpaul-patch-2-cca9249-rpqsv
kubernetes.labels.tekton_dev/pipelineRun gpaul-cicd-hello-world-gpaul-patch-2-cca9249-rpqsv
kubernetes.labels.tekton_dev/pipelineTask build
kubernetes.labels.tekton_dev/task build-hxskm
kubernetes.labels.tekton_dev/taskRun gpaul-cicd-hello-world-gpaul-patch-2-cca9249-rpqsv-build-lg9wm
kubernetes.namespace_name dispatch
kubernetes.pod_id d867bc76-1121-42ca-a53f-a1806b132513
kubernetes.pod_name gpaul-cicd-hello-world-gpaul-patch-2-cca9249-rpqsv-build-lg9wm-pod-dfedbc
message some line of output generated by the build
stream stderr