Browse logs for an application

To access logs, you have two options:

Browse Logs using UI

To see the logs for a particular service, you need to select that application from the deployments section, then click on the Logs button in the top right corner of the dashboard.

The logs would be visible in the UI as given below:

Browse Logs using CLI

We can also see the logs of any application from CLI using the FQN of that application. We can find the application FQN in the dashboard.

Command for viewing logs:

sfy logs --application-fqn <Application FQN here>

Flags used for filtering logs

  • --version <Version Number>
    It is fetch logs from a particular application version

    sfy logs --application-fqn <Application FQN here> --version <Version Number>
    
  • --since <Timestamp or Relative>
    Mention the timestamp from which you need to see the logs.
    For example: --since 2023-04-17T13:39:31.820139+05:30
    You can also mention the relative time such as (2h for 2 hours, 80m for 80 minutes, 4d for 4 days)
    For example: --since 20h
    By default it is set to 2 hours.

    sfy logs --application-fqn <Application FQN here> --since <Timestamp>
    
    sfy logs --application-fqn <Application FQN here> --since <Relative time>
    
  • --until <Timestamp or Relative>
    Mention the timestamp until which you need to see the logs.
    For example: --until 2023-04-17T13:39:31.820139+05:30
    You can also mention the relative time such as (2h for 2 hours, 80m for 80 minutes)
    For example: --until 20h

    sfy logs --application-fqn <Application FQN here> --until <Timestamp>
    
    sfy logs --application-fqn <Application FQN here> --until <Relative time>
    
  • --tail <Number> or -n <Number>
    Number of logs we want to tail
    For example: --tail 5

    sfy logs --application-fqn <Application FQN here> --tail <num>
    

To see all the options we can use the following command:

sfy logs --help