IBM Cloud Docs
Logging for Hyper Protect Virtual Servers for VPC

Logging for Hyper Protect Virtual Servers for VPC

To launch a Hyper Protect Virtual Servers for VPC instance, you (as the deployer) need to set up logging first by adding the logging configuration in the env section of the contract. The instance reads the configuration and configures logging accordingly. All other services start only after logging is configured. If the logging configuration is incorrect, the instance will not start and an error message will be displayed in the serial console.

The logs include startup logs, service logs issued by the Hyper Protect Virtual Servers for VPC instance, and container logs.

If your workload produces sensitive information, you can encrypt your log messages.

The following logging services are supported.

IBM Cloud Logs (ICL)

IBM® Cloud Logs is a scalable logging service that persists logs and provides users with capabilities for querying, tailing, and visualizing logs.

Logs are comprised of events that are typically human-readable and have different formats, for example, unstructured text, JSON, delimiter-separated values, key-value pairs, and so on. The IBM Cloud Logs service can manage general purpose application logs, platform logs, or structured audit events. IBM Cloud Logs can be used with logs from both IBM Cloud services and customer applications.

For information about IBM Cloud Logs, see IBM Cloud Logs.

Access to IBM Cloud Logs:

Access to IBM Cloud Logs instances for users in vpc account is controlled by IBM Cloud® Identity and Access Management (IAM). Every user that accesses the IBM Cloud Logs in vpc account must be assigned an access policy with an IAM role.

Access policies to be added:

  • Cloud Logs

To add relevant roles for these policies, refer to Managing IAM access for IBM Cloud Logs

Provisioning an ICL instance

To provision an ICL instance from the Observability dashboard in the IBM Cloud, complete the following steps:

  1. Log in to your IBM Cloud account.
  2. Provision an ICL instance. Choose a plan according to your requirements.

Input parameters to be provided in env section of contract are:

  • [required] iamApiKey key for the service id. Generate and retrieve the API key from the service ID in IAM.

  • [required] hostname of the service instance. Retrieve the Hostname from the ICL instance in the Endpoints section, labeled as the Public Ingress endpoint.

  • [required] port of the service instance. That is 443.

Add these values in the env logging subsection of the contract as the following example shows. For more information, see the logging subsection.

 env:
   logging:
     logRouter:
       hostname: <host name of the service instance> /
       iamApiKey: <iamApiKey of the service instance> / xxxx
       port: <port of the service instance(443).

Note: Custom tags are not supported for ICL.

To see the logs, open ICL instance.

Applying Filters in an ICL Instance

Add Columns for Log Messages: Include the following columns to display detailed log messages:

  • Timestamp | _HOSTNAME | Syslog_Identifier | Severity | Message

Filter by Hostname:

  • Use the _HOSTNAME filter and select the desired hostname to view logs from a specific source.

Filter by Log Level:

  • Apply the Severity filter and choose the appropriate log level to filter messages based on severity.

Filter By Service:

  • Add the Syslog_Identifier filter to see logs from a specific service.

Filter by Image Name, Container Name, and Container ID:

  • Add filters for IMAGE_NAME, CONTAINER_NAME, and CONTAINER_ID to refine the logs further.

View Additional Log Details:

  • Select the Text option in the column to see more details about each log entry.

Explore Other Filters:

  • Additional filters are available and can be applied based on specific requirements.

For more information, see Managing IBM Cloud Logs logging instances.

Steps to migrate for existing customers:

  • Create an ICL instance
  • Prepare a contract modifying the logging section from LogDNA to ICL
  • Bring down the current HPVS, without deleting the data volumes
  • Create new HPVS attaching the existing volumes with the new contract

Syslog

You can also configure logging with a generic syslog backend such as an rsyslog server or a Logstash server. The Hyper Protect Virtual Servers for VPC instance uses TLS with mutual authentication to connect to the logging backend. Find the following pieces of information to configure logging:

  • Syslog hostname and port
  • Certificate Authority (CA) - the certificate used to verify the certificate chain both for client and server authentication. Note that the same CA has to be used for both the client and server certificates.
  • Client certificate - used to prove the client to the server, signed by the CA
  • Client key - private key used by the virtual server instance to establish trust

Fill in the following parts of the contract with the information. The certificates and the key have to be in PEM format.

env:
  logging:
    syslog:
      hostname: ${HOSTNAME}
      port: ${PORT}
      server: ${CA}
      cert: ${CLIENT_CERTIFICATE}
      key: ${CLIENT_PRIVATE_KEY}

Make sure to use a strong digest algorithm for the certificates, otherwise the syslog server might reject the certificates.

Example

You can follow the following procedure to create the required certificates and keys. The example uses openssl and shows bash syntax.

Preparation

  1. Create a CA private key and a certificate signing request (CSR).

    Prepare the ca.cnf configuration file:

    [ req ]
    default_bits = 2048
    default_md = sha256
    prompt = no
    encrypt_key = no
    distinguished_name = dn
    
    [ dn ]
    C = US
    O = Logstash Test CA
    CN = ca.example.org
    

    Make sure to update dn with your values. The actual values can be freely selected and they do not play a role for the subsequent processing.

    Create the key and certificate.

    # create private key
    openssl genrsa -out ca-key.pem 4096
    # create CSR
    openssl req -config ca.cnf -key ca-key.pem -new -out ca-req.csr
    # create self-signed CA
    openssl x509 -signkey ca-key.pem -in ca-req.csr -req -days 365 -out ca.crt
    
  2. Create files used on the server side (the rsyslog server).

    Prepare the server.cnf configuration file. It's important to set the default_md value to at least sha256. Make sure to fill in the correct information for the dn field. It's preferred to use a domain name for CN but an IP address works too. For more information, see the OpenSSL documentation on Subject Alternative Name.

    Example that uses a hostname:

    [ req ]
    default_bits = 2048
    default_md = sha256
    prompt = no
    encrypt_key = no
    distinguished_name = dn
    
    [ server ]
    subjectAltName = DNS:${HOSTNAME}
    extendedKeyUsage = serverAuth
    
    [ dn ]
    C = US
    O = Rsyslog Test Server
    CN = ${HOSTNAME}
    

    Example that uses an IP address:

    [ req ]
    default_bits = 2048
    default_md = sha256
    prompt = no
    encrypt_key = no
    distinguished_name = dn
    
    [ server ]
    subjectAltName = IP:${IP}
    extendedKeyUsage = serverAuth
    
    [ dn ]
    C = US
    O = Rsyslog Test Server
    CN = ${IP_OR_HOSTNAME}
    

    Create the key and certificate. Make sure the server certificate server.crt contains a SAN for the IP or the hostname, depending on whether the server is accessed via IP or hostname.

    # create private key
    openssl genrsa -out server-key.pem 4096
    # create CSR for the server certificate
    openssl req -config server.cnf -key server-key.pem -new -out server-req.csr
    # have the CA created in (1) sign the certificate
    openssl x509 -req -in server-req.csr -days 365 -CA ca.crt -CAkey ca-key.pem -CAcreateserial -extfile server.cnf -extensions server -out server.crt
    
  3. Create files used on the client side (the Hyper Protect Virtual Servers for VPC instance).

    Prepare the client.cnf configuration file:

    [ req ]
    default_bits = 2048
    default_md = sha256
    prompt = no
    encrypt_key = no
    distinguished_name = dn
    
    [ dn ]
    C = US
    O = Logstash Test Client
    CN = client.example.org
    

    Make sure to update dn with your values. Whether the actual values play a role depends on the StreamDriver.Authmode setting (which appears in the following documentation). In this example, we use the setting StreamDriver.Authmode="x509/certvalid" and in this case, the value of dn does not play a role (since all valid client certificates are accepted). Adjust this according to your needs. For more information, see StreamDriver.Authmode.

    Create the key and certificate:

    # create private key
    openssl genrsa -out client-key.pem 4096
    # create CSR for client auh
    openssl req -config client.cnf -key client-key.pem -new -out client-req.csr
    # have the CA created in (2) sign the certificate
    openssl x509 -req -in client-req.csr -days 365 -CA ca.crt -CAkey ca-key.pem -CAcreateserial -out client.crt
    # export key to PKCS#8 format
    openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in client-key.pem -out client-key-pkcs8.pem
    

Client setup

Configure the contract with the following template.

env: 
    logging:
        syslog:
            hostname: ${HOSTNAME}
            port: ${PORT}
            server: ${CA}
            cert: ${CLIENT_CERTIFICATE}
            key: ${CLIENT_PRIVATE_KEY}

Use the content of the following files in preparation to fill in the placeholders:

  • ${CA} - ca.crt from preparation step 1
  • ${CLIENT_CERTIFICATE} - client.crt from preparation step 3
  • ${CLIENT_PRIVATE_KEY} - client-key-pkcs8.pem from preparation step 3

${HOSTNAME}, ${CA}, ${CLIENT_CERTIFICATE}, and ${CLIENT_PRIVATE_KEY} are strings without extra encoding or escaping. Regardless of the way you format them, make sure you use valid YAML (see Scalars). In the following example, the new lines are replaced with \n and carriage returns are deleted to make sure the content fits in one line between the inverted commas (see scalars in double-quoted style). You can also use other valid YAML variations.

Example:

env: 
    logging:
        syslog:
            hostname: 9.20.7.92
            port: 16999
            server: "-----BEGIN CERTIFICATE-----\nMIIFCTCCAvECFEp7wJLz4jNStIsVH2dUeHDN26ZyMA0GCSqGSIb3DQEBCwUAMEEx\nCzAJBgNVBAYTAlVTMRkwFwYDVQQKDBBMb2dzdGFzaCBUZXN0IENBMRcwFQYDVQQD\nDA5jYS5leGFtcGxlLm9yZzAeFw0yMzAxMDUxNjU0MTNaFw0yNDAxMDUxNjU0MTNa\nMEExCzAJBgNVBAYTAlVTMRkwFwYDVQQKDBBMb2dzdGFzaCBUZXN0IENBMRcwFQYD\nVQQDDA5jYS5leGFtcGxlLm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aIibpBAI7BEfTvJ8Eg/m20w1H\nrPRP1j6GYhpkAIm2+TVx6DFY/JO6JM1i0tzHv7zihSeji0lwBMKJ7M0TRXz1dJeR\n3GsDlD7mKwLVaBBKQ1Uxh1zYbiaUzVst1S2Wdvt13f89IV4Mmmuq2v1Uz4je7pDB\nhJITxResgCTR2aD0nMzF8egEKJoY\n-----END PRIVATE KEY-----\n"

Server setup

There are many ways to set up a compatible server endpoint. The following example shows a simple setup of an rsyslog server.

  1. Install the required server packages (example shows Ubuntu).

    apt-get install rsyslog rsyslog-gnutls
    
  2. Get certificates and keys from the preparation steps.

    • ca.crt - from step 1, copy to /certs/ca.crt
    • server.crt - from step 2, copy to /certs/server.crt
    • server-key.pem - from step 2, copy to /certs/server-key.pem
  3. Configure the rsyslog server in the /etc/rsyslog.d/server.conf file.

    # output to journal
    module(load="omjournal")
    template(name="journal" type="list") {
    # can add other metadata here
    property(outname="PRIORITY" name="pri")
    property(outname="SYSLOG_FACILITY" name="syslogfacility")
    property(outname="SYSLOG_IDENTIFIER" name="app-name")
    property(outname="HOSTNAME" name="hostname")
    property(outname="MESSAGE"  name="msg")
    }
    
    ruleset(name="journal-output") {
    action(type="omjournal" template="journal")
    }
    
    # make gtls driver the default and set certificate files
    $DefaultNetstreamDriver "gtls"
    $DefaultNetstreamDriverCAFile /certs/ca.crt
    $DefaultNetstreamDriverCertFile /certs/server.crt
    $DefaultNetstreamDriverKeyFile /certs/server-key.pem
    
    # load TCP listener
    module(
    load="imtcp"
    StreamDriver.Name="gtls"
    StreamDriver.Mode="1"
    StreamDriver.Authmode="x509/certvalid"
    )
    
    # start up listener at port ${PORT}
    input(
    type="imtcp"
    port="${PORT}"
    ruleset="journal-output"
    )    
    

    Make sure to fill in the ${PORT} placeholder. It must match the ${PORT} setting in the contract.

    The example config will log the received logs to its own journal. In a production setup, you might want to forward the logs to a database, but this is outside of the scope of this documentation.

    The gnutls package poses requirements on the signatures for the client certificate. Make sure to meet them.

    In this configuration, we accept any client certificate that is signed by the certificate authority via the x509/certvalid mode. This may change depending on the StreamDriver.Authmode setting. See StreamDriver.Authmode.

  4. Restart the syslog service.

    service syslog restart
    

IBM Cloud Log Analysis

Logging to Log Analysis is dependent on the state and health of the Log Analysis service. Service outages might lead to a loss of log data. If you want to log data for audit purposes, it's suggested that you employ your own logging service.

Deprecation of Log Analysis and IBM Cloud Activity Tracker services
Effective 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. IBM Cloud Logs will become generally available during the summer of 2024 in Frankfurt and Madrid with day-one support for EU-managed controls. The service will continue its worldwide multizone region (MZR) roll-out through 3Q2024. For information about IBM Cloud Logs, see the IBM Cloud Logs documentation.
  1. Log in to your IBM Cloud account.

  2. Provision a Log Analysis instance. Choose a plan according to your requirements.

  3. After you create the Log Analysis instance, click it open and click Open dashboard.

  4. Click the question mark icon (Install Instructions) at the lower left of the page. On the Add Log Source page, under Via Syslog, click rsyslog.

  5. Make a note of the ingestion key value at the upper right of the page, and the endpoint value. In the following example, the endpoint value is syslog-u.au-syd.logging.cloud.ibm.com.

    ### START Log Analysis rsyslog logging directives ###
    
    ## TCP TLS only ##
    $DefaultNetstreamDriverCAFile /etc/ld-root-ca.crt # trust these CAs
    $ActionSendStreamDriver gtls # use gtls netstream driver
    $ActionSendStreamDriverMode 1 # require TLS
    $ActionSendStreamDriverAuthMode x509/name # authenticate by hostname
    $ActionSendStreamDriverPermittedPeer *.au-syd.logging.cloud.ibm.com
    ## End TCP TLS only ##
    
    $template LogDNAFormat,"<%PRI%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [logdna@48950 key=\"bc8a5ba9aa5c0c12b26c6c45089228a4\"] %msg%"
    
    # Send messages to Log Analysis over TCP using the template.
    *.* @@syslog-u.au-syd.logging.cloud.ibm.com:6514;LogDNAFormat
    
    ### END Log Analysis rsyslog logging directives ###
    
  6. Add these values in the env logging subsection of the contract as the following example shows. For more information, see the logging subsection.

    env:
      logging:
        logDNA:
          hostname: ${RSYSLOG_LOGDNA_HOSTNAME}
          ingestionKey: ${LOGDNA_INGESTION_KEY}
    

    When the Hyper Protect Virtual Servers for VPC instance boots, it extracts the Log Analysis information from the contract and configures accordingly so that all the logs are routed to the endpoint specified. Then, you can open the Log Analysis dashboard and view the logs from the virtual server instance.

  7. If the LogDNA is used for collecting logs from multiple systems, you can utilise custom tags to isolate logs optionally. Following is an example of a custom tag:

    env:
       logging:
          logDNA:
                hostname: ${RSYSLOG_LOGDNA_HOSTNAME}
                ingestionKey: ${LOGDNA_INGESTION_KEY}
                tags: ["custom tag name 1", "custom tag name 2"]
    

Note: Special characters and escape sequences are not supported. The instance will remove these characters from the tags.