Using LogDNA with IBM Blockchain Platform
Using LogDNA to access logs from an IBP Kubernetes cluster can help troubleshoot problems.
Here’s how!
You will need
-
An existing IBP Blockchain Platfrom service
-
The jq command-line JSON processor
Make sure you’re logged in using ibmcloud login -a cloud.ibm.com
(you may need to use the --sso
option)
Set up the LogDNA service
-
Create an IBM Log Analysis with LogDNA service
-
Get the ingestion key (you can view this in the UI, or use the commands below)
Start by finding the LogDNA service you just created:
ibmcloud resource service-instances
Use the LogDNA service name to create an environment for the ingestion key which we’ll use later:
export LOGDNA_KEY=$(ibmcloud resource service-keys --instance-name "IBM Log Analysis with LogDNA-demo" --output json | jq -r '.[0].credentials.ingestion_key')
Configure the IBP Kubernetes cluster
- Use your LogDNA service ingestion key to configure your Kubernetes cluster to send logs to your LogDNA instance
Start by finding your IBP Kubernetes cluster:
ibmcloud ks cluster ls
Use the cluster ID to download the Kubernetes configuration files and certificates required for kubectl commands to connect to your IBP cluster:
ibmcloud ks cluster config --cluster bv56eljd05dlt2gm5lng
Verify that the kubeconfig file was updated successfully:
kubectl get nodes
Note: The following commands are also shown on the “Add agents to desired log sources” page of the “IBM Log Analysis with LogDNA” service.
Create a new namespace:
kubectl create namespace ibm-observe
Create a Kubernetes secret to store your LogDNA ingestion key:
kubectl create secret generic logdna-agent-key -n ibm-observe --from-literal=logdna-agent-key=$LOGDNA_KEY
Create a Kubernetes daemon set to deploy the LogDNA agent on every worker node of your Kubernetes cluster:
kubectl create -f https://assets.us-south.logging.cloud.ibm.com/clients/agent-resources.yaml
Verify that the LogDNA agent is deployed successfully
kubectl get pods -n ibm-observe
Now you’re ready to start viewing IBM Blockchain Platform logs!