Document audit logging tracing ID support (v1.18.0) (#2287)

* Document audit logging tracing ID support (v1.18.0)

Add a "Tracing IDs" subsection to the Audit Logging section of security.md,
and code snippets for all six client SDKs showing how to attach an
x-request-id header to requests so it appears in audit log entries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Small edits

* Don't hide imports in Python snippet

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Abdon Pijpelink
2026-04-23 09:44:02 +02:00
committed by GitHub
co-authored by Claude Sonnet 4.6
parent e231339968
commit c4ee144773
16 changed files with 139 additions and 0 deletions
@@ -0,0 +1 @@
Attach a tracing ID to a request so it appears in the audit log entry for that request.
@@ -0,0 +1,3 @@
curl -X GET http://localhost:6333/collections \
--header 'api-key: your_api_key_here' \
--header 'x-request-id: my-trace-id'
@@ -0,0 +1,14 @@
using Qdrant.Client;
public class Snippet
{
public static async Task Run()
{
// @hide-start
var client = new QdrantClient("localhost", 6334);
// @hide-end
using (RequestHeaders.Use("x-request-id", "my-trace-id"))
await client.ListCollectionsAsync();
}
}
@@ -0,0 +1,5 @@
```bash
curl -X GET http://localhost:6333/collections \
--header 'api-key: your_api_key_here' \
--header 'x-request-id: my-trace-id'
```
@@ -0,0 +1,6 @@
```csharp
using Qdrant.Client;
using (RequestHeaders.Use("x-request-id", "my-trace-id"))
await client.ListCollectionsAsync();
```
@@ -0,0 +1,10 @@
```go
import (
"context"
"github.com/qdrant/go-client/qdrant"
)
ctx := qdrant.WithHeader(context.Background(), "x-request-id", "my-trace-id")
client.ListCollections(ctx)
```
@@ -0,0 +1,9 @@
```java
import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;
import io.qdrant.client.RequestHeaders;
import io.grpc.Context;
Context ctx = RequestHeaders.withHeader(Context.current(), "x-request-id", "my-trace-id");
ctx.run(() -> client.listCollectionsAsync());
```
@@ -0,0 +1,6 @@
```python
from qdrant_client import QdrantClient, headers
with headers({"x-request-id": "my-trace-id"}):
client.get_collections()
```
@@ -0,0 +1,8 @@
```rust
use qdrant_client::Qdrant;
client
.with_header("x-request-id", "my-trace-id")
.list_collections()
.await?;
```
@@ -0,0 +1,7 @@
```typescript
import { QdrantClient, withHeaders } from "@qdrant/js-client-rest";
const result = await withHeaders({ "x-request-id": "my-trace-id" }, () =>
client.getCollections()
);
```
@@ -0,0 +1,17 @@
package snippet
import (
"context"
"github.com/qdrant/go-client/qdrant"
)
func Main() {
// @hide-start
client, err := qdrant.NewClient(&qdrant.Config{Host: "localhost", Port: 6334})
if err != nil { panic(err) }
// @hide-end
ctx := qdrant.WithHeader(context.Background(), "x-request-id", "my-trace-id")
client.ListCollections(ctx)
}
@@ -0,0 +1,18 @@
package com.example.snippets_amalgamation;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;
import io.qdrant.client.RequestHeaders;
import io.grpc.Context;
public class Snippet {
public static void run() throws Exception {
// @hide-start
QdrantClient client = new QdrantClient(
QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
// @hide-end
Context ctx = RequestHeaders.withHeader(Context.current(), "x-request-id", "my-trace-id");
ctx.run(() -> client.listCollectionsAsync());
}
}
@@ -0,0 +1,6 @@
from qdrant_client import QdrantClient, headers
client = QdrantClient(url="http://localhost:6333") # @hide
with headers({"x-request-id": "my-trace-id"}):
client.get_collections()
@@ -0,0 +1,12 @@
use qdrant_client::Qdrant;
pub async fn main() -> anyhow::Result<()> {
let client = Qdrant::from_url("http://localhost:6334").build()?; // @hide
client
.with_header("x-request-id", "my-trace-id")
.list_collections()
.await?;
Ok(())
}
@@ -0,0 +1,7 @@
import { QdrantClient, withHeaders } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 }); // @hide
const result = await withHeaders({ "x-request-id": "my-trace-id" }, () =>
client.getCollections()
);
@@ -487,6 +487,16 @@ By default, audit logs are rotated daily, and the seven most recent log files ar
<aside role="alert">Audit logging is verbose and audit logs can grow in size rapidly. Ensure that you have sufficient disk space.</aside>
### Tracing IDs
*Available as of v1.18.0*
You can attach a tracing ID to individual requests. When audit logging is enabled, Qdrant includes the tracing ID in the audit log entry, enabling the correlation of client-side operations with their corresponding log entries.
Qdrant reads the tracing ID from the first matching header in the following order: `x-request-id`, `x-tracing-id`, `traceparent`. Tracing IDs longer than 256 characters are truncated.
{{< code-snippet path="/documentation/headless/snippets/audit-tracing-id/simple/" >}}
## Network Bind
By default, a custom Qdrant deployment binds to all network interfaces. Your