IBM Cloud Docs
Disconnecting a logging agent

Disconnecting a logging agent

Detach a logging agent from a logging instance to stop collecting logs.

As of 28 March 2024 the IBM Log Analysis and IBM Cloud Activity Tracker services are deprecated and will no longer be supported as of 30 March 2025. Customers will need to migrate to IBM Cloud Logs, which replaces these two services, prior to 30 March 2025. For information about IBM Cloud Logs, see the IBM Cloud Logs documentation.

Detaching a logging agent from a standard Kubernetes cluster

To stop your Kubernetes cluster from sending logs to your IBM Log Analysis instance, you must remove the logging agent from your cluster.

Detaching a logging agent by using the agent yaml file

To stop your Kubernetes cluster from forwarding logs to your logging instance, complete the following steps from the command line:

  1. Open a terminal. Then, log in to the IBM Cloud, and follow the prompts.

    Select the account where you provisioned the IBM Log Analysis instance.

  2. Set up the cluster environment. Run the following commands:

    First, get the command to set the environment variable and download the Kubernetes configuration files.

    ibmcloud ks cluster config --cluster <cluster_name_or_ID>
    
  3. Remove the secret from your Kubernetes cluster. The Kubernetes secret contains the logging ingestion key. Run the following command:

    kubectl delete secret logdna-agent-key -n ibm-observe
    
  4. Remove the logging agent on every worker(node) of your Kubernetes cluster. Run the following command:

    Type of endpoint Command
    Public endpoint kubectl delete -f https://assets.<REGION>.logging.cloud.ibm.com/clients/logdna-agent/<VERSION>/agent-resources.yaml
    Private endpoint kubectl delete -f https://assets.<REGION>.logging.cloud.ibm.com/clients/logdna-agent/<VERSION>/agent-resources-private.yaml

    Where

    • <REGION> indicates the region where the logging instance is available. For more information about regions, see Locations.
    • <VERSION> indicates the version of the agent that you have deployed. You must use a version that has a tag with the following format: X.Y.Z or use your custom yaml file.
  5. To verify that the logging agent is deleted successfully, run the following command:

    kubectl get pods -n ibm-observe
    

    You should not see any logging pods.

Detaching a logging agent by using kubectl commands

To stop your Kubernetes cluster from forwarding logs to your logging instance, complete the following steps from the command line:

  1. Open a terminal. Then, log in to the IBM Cloud, and follow the prompts.

    Select the account where you provisioned the IBM Log Analysis instance.

  2. Set up the cluster environment. Run the following commands:

    First, get the command to set the environment variable and download the Kubernetes configuration files.

    ibmcloud ks cluster config --cluster <cluster_name_or_ID>
    
  3. Remove the secret from your Kubernetes cluster. The Kubernetes secret contains the logging ingestion key. Run the following command:

    kubectl delete secret logdna-agent-key -n ibm-observe
    
  4. Remove the logging agent on every worker(node) of your Kubernetes cluster. The logging agent is responsible for collecting and forwarding your logs. Run the following command:

    kubectl delete daemonset logdna-agent -n ibm-observe
    
  5. To verify that the logging agent is deleted successfully, run the following command:

    kubectl get pods -n ibm-observe
    

    You should not see any logging pods.

Detaching a logging agent from the cluster console

This option is only valid when you deploy the logging agent from the IBM Cloud Kubernetes Service console.

Complete the following steps from the IBM Cloud Kubernetes Service console:

  1. Select the cluster for which you want to create a logging logging configuration.

  2. On the cluster Overview page, in the Logging section, click Disconnect.

Detaching a logging agent by using ob commands

This option is only valid when you deploy the logging agent by using ob commands.

Complete the following steps:

  1. Set the cluster context.

    Open a terminal to log in to IBM Cloud.

    ibmcloud login -a cloud.ibm.com
    

    Select the account where you provisioned the IBM Log Analysis instance.

    List the clusters to find out in which region and resource group the cluster is available.

    ibmcloud ks clusters
    

    Set the resource group and region.

    ibmcloud target -g RESOURCE_GROUP -r REGION
    

    Where

    RESOURCE_GROUP is the name of the resource group where the cluster is available, for example, default.

    REGION is the region where the cluster is available, for example, us-south.

    Set the cluster where you want to configure logging as the context for this session.

    ibmcloud ks cluster config --cluster <cluster_name_or_ID>
    
  2. Detach the logging agent by using the ob CLI. Run the following command:

    ibmcloud ob logging config delete --cluster <cluster_name_or_ID> --instance <LogDNA_instance_name_or_ID>  [--force]
    

    Where

    • <cluster_name_or_ID> is the name or the ID of the cluster.

    • <LogDNA_instance_name_or_ID> is the name or the ID of the logging instance where you want to forward the cluster logs for analysis.

    • [--force] is used to force the command to run with no user prompts.

Detaching a logging agent from an Openshift Kubernetes cluster

To stop your OpenShift cluster from sending logs to your IBM Log Analysis instance, you must remove the logging agent from your cluster.

Detaching a logging agent by using kubectl commands

Complete the following steps from the command line:

  1. Open a terminal to log in to IBM Cloud.

    ibmcloud login -a cloud.ibm.com
    

    Select the account where you provisioned the IBM Log Analysis instance.

  2. Set the cluster where you want to configure logging as the context for this session.

    ibmcloud cs cluster config --cluster <cluster_name_or_ID>
    
  3. Log in to the cluster. Choose a method to login to an OpenShift cluster. Learn more about the methods to login.

  4. Delete the logging agent serviceaccount.

    oc delete serviceaccount logdna-agent -n ibm-observe
    
  5. Remove the logging secrets from your cluster. Each secret contains the logging ingestion key. Run the following commands:

    List secrets.

    oc get secrets -n ibm-observe
    

    Then, run the following command for each secret:

    oc delete secret logdna-agent-key -n ibm-observe
    
  6. Remove the logging agent on every worker(node) of your Kubernetes cluster. The logging agent is responsible for collecting and forwarding your logs. Run the following command:

    kubectl delete -f https://<ENDPOINT>/clients/logdna-agent-ds-os.yaml -n ibm-observe
    

    Where <ENDPOINT> is the endpoint where the agent was installed.

  7. Verify that the logging agent is deleted successfully. Run the following command to verify that logging agent pods are not running:

    oc get pods -n ibm-observe
    

Detaching a logging agent from the OpenShift console

This option is only valid when you deploy the logging agent from the OpenShift console.

Complete the following steps from the OpenShift console:

  1. Select the cluster for which you want to create a logging logging configuration.

  2. On the cluster Overview page, in the Logging section, click Disconnect.

Detaching a logging agent by using ob commands

This option is only valid when you deploy the logging agent by using ob commands.

Complete the following steps:

  1. Set the cluster context.

    Open a terminal to log in to IBM Cloud.

    ibmcloud login -a cloud.ibm.com
    

    Select the account where you provisioned the IBM Log Analysis instance.

    List the clusters to find out in which region and resource group the cluster is available.

    ibmcloud ks clusters
    

    Set the resource group and region.

    ibmcloud target -g RESOURCE_GROUP -r REGION
    

    Where

    RESOURCE_GROUP is the name of the resource group where the cluster is available, for example, default.

    REGION is the region where the cluster is available, for example, us-south.

    Set the cluster where you want to configure logging as the context for this session.

    ibmcloud oc cluster config --cluster <cluster_name_or_ID>
    
  2. Detach the logging agent by using the ob CLI. Run the following command:

    ibmcloud ob logging config delete --cluster <cluster_name_or_ID> --instance <LogDNA_instance_name_or_ID>  [--force]
    

    Where

    • <cluster_name_or_ID> is the name or the ID of the cluster.

    • <LogDNA_instance_name_or_ID> is the name or the ID of the logging instance where you want to forward the cluster logs for analysis.

    • [--force] is used to force the command to run with no user prompts.