Access to logs
Knowing the application behaviour is a crucial thing in the development process - allowing developers to investigate what happened in the app by accessing the logs. With logs, the developer or operator can properly optimize and debug the test and production environments. Our Cloud offers two possible ways to display logs.
Access via CLI
The easiest way to access logs is to use the kubectl
command line tool.
A kube.config
configuration file is required to access the instance via the kubectl
CLI. The command line access guide can help you get set up.
Usage
Here are some examples using the kubectl
CLI tool to get a list of pods and display logs from one of that pods.
You can omit specifying kubeconfig if you have exported KUBECONFIG
environment variable.
List the pods:
$ kubectl --kubeconfig </path/to/your/kubeconfig> -n <instance_name>-<region>-<provider>-storefrontcloud-io get pods
NAME READY STATUS RESTARTS AGE
...
vue-storefront-754cc8674-7njnx 1/1 Running 0 2d3h
vue-storefront-754cc8674-gvtvq 1/1 Running 1 2d
Get the logs:
$ kubectl --kubeconfig </path/to/your/kubeconfig> -n <instance_name>-<region>-<provider>-storefrontcloud-io logs vue-storefront-754cc8674-7njnx
Check out the official kubectl
referrence for more options to the kubectl logs command.
Access via API
Another way to access logs is through our API.
To get logs for the specific pod you should call /instance/<instance_name>-<region>-<provider>-storefrontcloud-io/pod/<pod_name>/log
API endpoint. Continue to API reference for more information.
Usage
Call the API pods endpoint to get a current list of pods in your instance:
$ curl -H "X-User-Id: $VSFC_USER_ID" \
-H "X-Api-Key: $VSFC_API_KEY" \
-H 'Content-Type: application/json' \
-X GET https://farmer.storefrontcloud.io/instance/<instance_name>-<region>-<provider>-storefrontcloud-io/pod
Choose one of the pods and perform another request:
$ curl -H "X-User-Id: $VSFC_USER_ID" \
-H "X-Api-Key: $VSFC_API_KEY" \
-H 'Content-Type: application/json' \
-X GET https://farmer.storefrontcloud.io/instance/<instance_name>-<region>-<provider>-storefrontcloud-io/pod/<pod_name>/log
Sending logs to an external logging system
Our Cloud is based on Kubernetes and because of that our platform is highly customizable. One of the most powerful Kubernetes feature is the ability to add sidecar containers with the logging agent. We use Fluentd - it is an unified logging layer.
Currently we support integrations with the following solutions:
- Loki
- Azure Log Analytics
- Datadog
- New Relic
Using Fluentd Plugins we can integrate our Cloud with almost all popular external log aggregation platforms.
If you need to integrate with another external logging platform, please contact our support.