This topic describes log-related commands in Function Compute Command Line Interface (fcli).
In the folder where the executable file is located, run the
fcli shell command to enter the interactive mode.
Run the mkl command to create a project and a Logstore
Run the mkl command to create a project and a Logstore for a service in Function Compute.
-p string: creates a project.
-s string: creates a Logstore.
>>> mkl -p my-log-project -s my-log-store myService // Create a project and a Logstore for a service in Function Compute. // The name of a project is globally unique. If the name has been used, the project fails to be created.
Run the logs command to query logs
Run the logs command to query logs.
--count int: sets the maximum number of returned rows of the log content. Default value: 1000.
--duration int: specifies the duration in which function logs are returned. Unit: seconds. Default value: 86400.
--end string: sets the end of the time range to query logs. Specify the time in the RFC3339 format. The time must be in UTC, such as 2017-01-01T01:02:03Z.
--start string: sets the beginning of the time range to query logs. Specify the time in the RFC3339 format. The time must be in UTC, such as 2017-01-01T01:02:03Z.
--tail: specifies Row i from the end to return the last i rows of the log content.
// In the corresponding service directory logs myFunction // By default, return the first 1,000 rows of the log content of the day. logs -d 60 -c 5000 myFunction // Return the log content for function execution within 1 minute. A maximum of 5,000 rows of the log content can be returned. logs -t -c 100 myFunction // Return the last 100 rows of the log content. logs -s 2018-01-22T18:00:00Z -e 2018-01-22T19:00:00Z myFunction // Return the log content generated from 18:00:00 to 19:00:00 on January 22, 2018.