IBM Cloud Docs
Monitoring logs

Monitoring logs

You can monitor many kinds of logs of the Hyper Protect Virtual Servers instances, for example, web server, or application logs. To enable the collection of such logs, you must use IBM Log Analysis with LogDNA on the Hyper Protect Virtual Servers instance.

Prerequisites

You must deploy a Hyper Protect Virtual Servers instance on IBM Cloud. Follow these instructions to provision a virtual server. To log in to the virtual server, follow these instructions.

Deploying IBM Log Analysis with LogDNA

In general, to deploy IBM Log Analysis with LogDNA, follow these instructions. You can configure platform logs when logging is active. If you want to configure a LogDNA agent for each log source that you want to monitor, follow these instructions for configuring a logging agent on Linux Ubuntu or Debian.

For Hyper Protect Virtual Servers, to configure a LogDNA agent for the IBM Z platform (s390x architecture), you must complete these steps:

  1. To install dependencies and update node, run:

    apt-get update
    
    apt-get install -y git npm curl wget
    
    npm install -g n
    
    n lts
    
    PATH="$PATH"
    
    node -v
    
  2. Get the source code for the logging agent from this GitHub repository.

    • To clone the repository, run:
      git clone https://github.com/logdna/logdna-agent.git
      
    • To install the agent from the source, run:
      cd logdna-agent && npm install
      
  3. Complete the following steps to configure the LogDNA agent:

    • To get the ingestion key, follow these instructions, where the INGESTION_KEY contains the ingestion key that is active for the IBM Log Analysis with the LogDNA instance that you are configuring to forward logs.

    • To get the values of APIHOST and LOGHOST, follow these instructions. You also can open the logging service by using the dashboard to get the values of APIHOST and LOGHOST. Run the following commands:

      node index.js -k <YOUR LOGDNA INGESTION KEY>
      
      node index.js -d /var/log
      
      node index.js -t logging
      
      node index.js -s <APIHOST>   
      

      For example, node index.js -s LOGDNA_APIHOST=api.us-south.logging.cloud.ibm.com

      node index.js -s <LOGHOST>
      

      For example, node index.js -s LOGDNA_LOGHOST=logs.us-south.logging.cloud.ibm.com

  4. To start the LogDNA agent, run:

    node index.js
    

Example -Checking the logs by using SSH log in and log out

You can configure the logs that you want to monitor with the agent so that the logs can be captured by using the web user interface.

  1. To check the settings of the agent, run:
    node index.js -l
    hostname       = af65e44fb2e6
    logdir         = [ /var/log, /var/log/audit.log ]
    key            = 46f2c83ba4cd5cfec500154181b9d95e
    tags           = logging
    LOGDNA_APIHOST = api.us-south.logging.cloud.ibm.com
    LOGDNA_LOGHOST = logs.us-south.logging.cloud.ibm.com
    
    
  2. Open the logging web user interface to check the log information, and then log in or log out of the Hyper Protect Virtual Servers instance many times, and update with the live button. You can view the logs by using the web user interface. You can follow these instructions for information about how to view the logs by using the web user interface.