🕓 10 minutes

What you’ll learn#

How to use logs of your application for monitoring, debugging, and better understanding the process behind the code.

  • Logging helps you to:
    • follow the system actions and information about user,
    • reveal application problems and where they occur.



Loki tool#

CodeNow is using the Loki tool for both logs and metrics, which is a horizontally-scallable log aggregation system.


  1. Find the "Logging&Tracing" section in the sidebar menu and go to the "Logging" option.


  1. You can investigate your application logs by entering the specific query into the query field and click on the "Run Query" button.
  • Some basic queries are:

    • Logs for your namespace: {namespace="_name_of_the_namespace_"}
    • Logs for the specific application: {app="_name_of_the_application_", namespace="_name_of_the_namespace_"}
  • NOTE: You can't use traceID for application logs.

  • You can find out more by looking at the "Loki Cheat Sheet", where you can find instructions on how to write queries for the Loki tool.



  1. The appeared graph shows you the request statistics in time. Below it you will find application logs.
  • Also you can change, if you'd like to see the time, unique labels, wrap lines or set the dedup.

  1. You can set the time range for your application, to see corresponding logs.

  1. For life monitoring of your application, click on the "Live" button.
    • For pausing or stopping the live monitoring, simply click on the "Live" button again.

  1. To see the history of your requested queries, click on the "Query history" button.
    • Inside, you will find a "Setting" section, where you can change the history time span and other options.

  1. If you want to add another query and run both of them at the same time, you can click on the "Add query" button.
    • If you want to remove one of the queries, simply click on the button with the minus sign on it.


  1. You can split your screen into two by clicking on the "split" sign.

  1. "Log labels" section contains predefined queries that you can use for your application.
    • You can search through the different categories such as container, node, release, stream etc.


  1. Metric queries extend the log queries and calculate the sample values based on the content of the logs from a log query.
  • Metric queries can be used to calculate things such as the rate of error messages, or the top N log sources with the most amount of logs over the last 3 hours.

  1. You can investigate your application metrics by entering the specific query into the query field.
  • You will see a graph that represents the statistics of the requests in time. Below it, you will find the application metrics.

  • You can look at the "LogQL Cheat Sheet", where you find instructions on how to write queries for extracting metrics.
    • TIP: Instead of a job , you can place the name of your namespace(namespace="_your_namespace_").

What’s next?#

See our other manuals: