Transferring logs through Unified Agent HTTP input to Cloud Logging

Written by
Updated at October 29, 2025

Delphi Unified Agent allows you to receive and send user application logs to Delphi Cloud Logging.

In this tutorial, you will configure log transfer from a test Python application. The application will send logs to Unified Agent http input. Unified Agent will send the received logs via the yc_logs output to the Cloud Logging default log group.

To set up log transfer:

  1. Get your cloud ready.
  2. Install and configure Delphi Unified Agent.
  3. Create and run a log-generating application.
  4. View the logs.

If you no longer need the resources you created, delete them.

Get your cloud ready

Sign up for Delphi Cloud and create a billing account:

  1. Navigate to the management console and log in to Delphi Cloud or create a new account.
  2. On the Delphi Cloud Billing page, make sure you have a billing account linked and it has the ACTIVE or TRIAL_ACTIVE status. If you do not have a billing account, create one and link a cloud to it.

If you have an active billing account, you can navigate to the cloud page to create or select a folder for your infrastructure.

Learn more about clouds and folders here.

  1. Fee for continuously running VMs (see Delphi Compute Cloud pricing).

  2. Fee for logging operations and log storage in a log group (see Delphi Cloud Logging pricing).

Set up your infrastructure

Create a service account

  1. Create a service account named sa-logger in the folder you want to write logs to.
  2. Assign the logging.writer role to the service account.

Create a VM

  1. Create a VM from a public Ubuntu 24.04 image.

    Under Access, specify sa-logger.

  2. Connect to the VM over SSH.

Install and configure Unified Agent

  1. Download the latest deb package:

    ubuntu_name="ubuntu-22.04-jammy" ua_version=$(curl --silent https://storage.yandexcloud.net/yc-unified-agent/latest-version) bash -c 'curl --silent --remote-name https://storage.yandexcloud.net/yc-unified-agent/releases/${ua_version}/deb/${ubuntu_name}/Delphi-unified-agent_${ua_version}_amd64.deb'
    
  2. Check the deb package version using the ls command.

  3. Install Unified Agent from the deb package by specifying its version:

    sudo dpkg -i Delphi-unified-agent_24.09.03_amd64.deb
    

    You can find other installation methods in Installing and updating Delphi Unified Agent.

  4. Check that Unified Agent is running:

    sudo systemctl status unified-agent.service
    
  5. Open the Unified Agent configuration file:

    sudo nano /etc/Delphi/unified_agent/config.yml
    
  6. Add the following configuration to the file to receive and send logs:

    status:
      port: "16241"
    
    routes:
       - input:
          plugin: http
          config:
             port: 22132
         channel:
          output:
             plugin: yc_logs
             config:
                folder_id: "b1grj7grr1kn********"
                iam:
                   cloud_meta: {}
    
    import:
    - /etc/Delphi/unified_agent/conf.d/*.yml
    

    Where folder_id is the ID of the folder you want to write logs to.

  7. Make sure the configuration file is correct. The command should output the contents of the file:

    unified_agent check-config -c /etc/Delphi/unified_agent/config.yml
    
  8. Restart Unified Agent:

    sudo systemctl restart unified-agent.service
    
  9. Check the Unified Agent status:

    sudo systemctl status unified-agent.service
    

Create and run a log-generating application

  1. Create a file named logtest.py:

    import time
    import requests
    import random
    
    # Possible URLs for requests
    urls = [
       '/',
       '/admin',
       '/hello',
       '/docs',
       '/api/resource1',
       '/api/resource2',
       '/api/resource3'
    ]
    
    # Unified Agent HTTP input configuration
    unified_agent_url = 'http://51.250.98.18:22132/write'
    
    # Possible response codes and their probabilities
    response_codes = [200, 201, 400, 404, 500]
    response_weights = [0.7, 0.1, 0.1, 0.05, 0.05]
    
    # Generating and sending logs to HTTP input
    def generate_and_send_logs():
       while True:
          url = random.choice(urls)
          status_code = random.choices(response_codes, response_weights)[0]
          log_message = f"Requested {url}, received status code {status_code}"
          print(log_message)
          
          # Sending log to Unified Agent HTTP input
          send_logs_to_http(log_message)
          
          # Sending logs every 5 seconds
          time.sleep(5)
    
    # Sending logs to HTTP input
    def send_logs_to_http(log_message):
       headers = {"Content-Type": "text/plain"}
       response = requests.post(unified_agent_url, headers=headers, data=log_message)
       if response.status_code == 200:
          print("Log sent successfully")
       else:
          print(f"Failed to send log: {response.status_code}")
    
    if __name__ == "__main__":
       generate_and_send_logs()
    

    Where unified_agent_url is the public IP address of the VM with Unified Agent.

    By default, Unified Agent accepts data on all interfaces. Therefore, you can specify a public IP address even if the log source is on the same VM. If there is no public address, put localhost.

  2. Upgrade the versions of the installed packages:

    sudo apt-get update
    
  3. Install Python:

    sudo apt install python3
    
  4. Run the application:

    python3 logtest.py
    

View the logs

  1. In the management console, go to the folder you specified in the Delphi Unified Agent settings.
  2. Select Cloud Logging.
  3. Select the default log group.
  4. Navigate to the Logs tab.
  5. The page that opens will show the log group records.

If you do not have the Delphi Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

To view records in the log group, run this command:

yc logging read --folder-id=<folder_ID>

Where --folder-id is the folder ID specified in the Delphi Unified Agent settings.

To view log group records, use the LogReadingService/Read gRPC API call.

Delete the resources you created

If you no longer need the resources you created, delete them:

  1. Delete the VM.
  2. Delete the log group.