ConduitSharp.Plugin.BodyCaptureToFile 2.0.0

dotnet add package ConduitSharp.Plugin.BodyCaptureToFile --version 2.0.0
                    
NuGet\Install-Package ConduitSharp.Plugin.BodyCaptureToFile -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ConduitSharp.Plugin.BodyCaptureToFile" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ConduitSharp.Plugin.BodyCaptureToFile" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ConduitSharp.Plugin.BodyCaptureToFile" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ConduitSharp.Plugin.BodyCaptureToFile --version 2.0.0
                    
#r "nuget: ConduitSharp.Plugin.BodyCaptureToFile, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ConduitSharp.Plugin.BodyCaptureToFile@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ConduitSharp.Plugin.BodyCaptureToFile&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ConduitSharp.Plugin.BodyCaptureToFile&version=2.0.0
                    
Install as a Cake Tool

ConduitSharp.Plugin.BodyCaptureToFile

Captures a bounded prefix of request bodies, response bodies, or both, to a rolling JSONL file. A bounded channel plus a background writer keeps the write off the request path.

Plugin variant: body-capture-file.

Why it is different from body-capture

body-capture emits through ILogger, so bodies land wherever your logging pipeline points (Loki, console, OTLP). This one writes a file you can grep, jq, and tail with no collector running.

Record

One JSON object per line, one line per captured direction:

{"time":"2026-08-14T09:12:33.4180000Z","path":"/v1/messages","traceId":"4bf92f...","direction":"request","body":"{\"model\":\"claude-opus-5\",...}"}

traceId = Activity.Current?.TraceId ?? HttpContext.TraceIdentifier. Same expression token-spend uses, fallback included, so a wire body joins to its spend row on that field whether or not a tracer is listening. Truncated bodies carry a ... (truncated) suffix inside body.

Config

{
  "name": "custom", "variant": "body-capture-file", "order": 9,
  "config": {
    "request":  { "maxSize": 4096 },
    "response": { "maxSize": 8192 },
    "logPath": "%CONDUIT_SPEND_DATA%/conduit-wire.jsonl",
    "maxFileBytes": 134217728,
    "decompress": true
  }
}
Setting Required Default Meaning
request.maxSize no — bytes of request body to capture; direction is off unless the block is present
response.maxSize no — same, for the response
logPath no /tmp/conduit-logs.json sink path; %VAR% expands on every platform
maxFileBytes no 134217728 (128 MiB) roll threshold
decompress no false gunzip/inflate before writing

A direction block present without maxSize captures 4096 bytes. The removed flat shape ({"maxSize": N}) throws at config validation.

An unset %VAR% is left literal rather than expanded to empty, so it fails loudly on the first write instead of silently writing to a wrong path.

decompress

Set it for any upstream that honours Accept-Encoding. Anthropic does. Without it a gzip response is written through a UTF-8 conversion that replaces invalid sequences, and the result cannot be decompressed afterwards: the bytes are gone, not merely encoded.

Rollover

At maxFileBytes the sink moves to <logPath>.1, deleting any previous .1. One backup generation, not a numbered series. A failed roll logs and the file keeps growing.

Backpressure and failure

queue bounded channel, capacity OTEL_BLRP_MAX_QUEUE_SIZE (default 2048), FullMode=DropWrite
under flood entries drop, requests are never blocked or failed
retained RAM capacity x the route's maxSize
writer crash logs request bodies are NO LONGER being captured, gateway keeps serving

Sensitivity

Bodies are stored in the clear. The file contains whatever the caller sent and whatever the model returned, including prompt text. Headers are not captured, so API keys stay out of it. Treat the file as sensitive and delete it when you are done.

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 111 8/14/2026