How to Configure Windows Sandbox Local OpenTelemetry Collector via XML in Windows 11

Modern cloud-native telemetry architectures rely on the OpenTelemetry (OTel) Collector to ingest, process, and export distributed traces, application metrics, and log pipelines. Testing collector routing configurations, processors, and export exporters locally on a developer workstation can cause port conflicts and service clutter. In Windows 11, Windows Sandbox offers an isolated, disposable guest environment. By configuring custom Windows Sandbox XML (.wsb) blueprints, you can deploy a fully automated OpenTelemetry Collector instance in seconds.

Architecture of Disposable Sandbox Telemetry

Windows Sandbox provides a lightweight, virtualised Windows 11 guest that resets to a clean state upon closure. To provision an automated OpenTelemetry pipeline, the architecture uses:

  • A mapped host folder: A directory holding the portable otelcol-contrib.exe binary and custom pipeline configuration YAML file.
  • A WSB blueprint: An XML file specifying folder mounting and an automated LogonCommand that boots the collector upon startup.

Authoring the Windows Sandbox WSB Blueprint

Create a dedicated folder on your host machine, such as C:\SandboxOTel. Download the Windows OTel Collector Contrib binary into this directory, then create LaunchOTel.wsb with the following XML structure:

<Configuration>
  <VGpu>Default</VGpu>
  <Networking>Default</Networking>
  <MappedFolders>
    <MappedFolder>
      <HostFolder>C:\SandboxOTel</HostFolder>
      <SandboxFolder>C:\OTelFiles</SandboxFolder>
      <ReadOnly>false</ReadOnly>
    </MappedFolder>
  </MappedFolders>
  <LogonCommand>
    <Command>powershell.exe -ExecutionPolicy Bypass -NoExit -File C:\OTelFiles\Start-Collector.ps1</Command>
  </LogonCommand>
</Configuration>

Authoring Collector Pipeline Configuration and Startup Script

Inside the mapped host folder (C:\SandboxOTel), create a collector configuration file named config.yaml:

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318

processors:
  batch:
    timeout: 1s

exporters:
  debug:
    verbosity: detailed

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [debug]
    metrics:
      receivers: [otlp]
      processors: [batch]
      exporters: [debug]

Next, create the automated PowerShell startup script named Start-Collector.ps1:

Write-Host "===============================================" -ForegroundColor Cyan
Write-Host " Starting OpenTelemetry Collector in Sandbox.. " -ForegroundColor Green
Write-Host " OTLP gRPC: 127.0.0.1:4317                     " -ForegroundColor Yellow
Write-Host " OTLP HTTP: 127.0.0.1:4318                     " -ForegroundColor Yellow
Write-Host "===============================================" -ForegroundColor Cyan

& "C:\OTelFiles\otelcol-contrib.exe" --config "C:\OTelFiles\config.yaml"

Running and Validating Telemetry in the Sandbox

Double-click LaunchOTel.wsb on your Windows 11 host. Windows Sandbox initialises, mounts the directory, and starts the OpenTelemetry Collector inside a PowerShell console.

The collector listens on ports 4317 (gRPC) and 4318 (HTTP). Point test applications or curl commands directly to the sandbox endpoints to dispatch sample trace spans and metric payloads. The collector console outputs detailed debug logs showing ingested spans and attributes.

Once pipeline validation concludes, closing the sandbox window instantly eliminates all processes, temporary files, and log dumps, leaving your host machine completely untouched.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.