Function Logs
The official and faas-netes
providers stream logs directly from the cluster API, this means that you will get the same logs as when you use docker service logs
and kubectl logs
. OpenFaaS only wraps wraps the existing container-native log systems, so you can always access function logs via the orchestration CLIs.
The command will stream the logs for the named function. By default, it will attempt to follow the logs, but you can control the behavior of the stream using these flags
where msg
is the container logs, this typically contains stdout and stderr of the contianer.
An example log output for nodeinfo
from the function store is
For example, when you set the write_debug
environment variable in the Sentiment Analysis function from the Store, it will print the function output to the logs, we can then search that output using grep. For example,
Log retention and history will be determined by your cluster configuration and the log provider installed. The default configuration in the official function providers (faas-swarm
and ) stream logs directly from the cluster containers. This means that you will only see logs from running function containers, no long term history. So deleting a function will also remove access to those logs.