Skip to content

Capture request headers in the audit topic #1027

Open
@yeikel

Description

@yeikel

Issue submitter TODO list

  • I've searched for an already existing issues here
  • I'm running a supported version of the application which is listed here and the feature is not present there

Is your proposal related to a problem?

I expose the UI behind a proxy that receives and forwards the request. This proxy includes additional and meaningful headers in the request that are currently not captured.

That causes the following data to be persisted in the audit logs that is not enough to trace/audit the usage :

{
	"timestamp": "2025-04-15T20:05:09.872497460Z",
	"username": "Unknown",
	"clusterName": "kafka-cluster",
	"resources": [],
	"operation": "getTopics",
	"result": {
		"success": true
	}
}

Describe the feature you're interested in

  1. Add a new entry in the configuration to specify the list of headers to log. For example, a tentative name could be audit-request-headers-properties

For example:

kafka:
  clusters:
    - name: local
      audit:
        topic-audit-enabled: true
        console-audit-enabled: true
        # The other properties were omitted for brevity
        # A list of request headers that should be persisted if present in the request
        audit-request-headers-properties:
          - User-Agent
          - my-custom-header    
  1. Read and persist the headers in the audit log under a new configuration property such as requestHeaders
{
	"timestamp": "2025-04-15T20:05:09.872497460Z",
	"username": "Unknown",
	"clusterName": "kafka-cluster",
	"resources": [],
        "requestHeaders": {
         "User-Agent" : "PostmanRuntime/7.30.0",
         "my-custom-header" : "the custom value"
}, 
	"operation": "getTopics",
	"result": {
		"success": true
	}
}

Describe alternatives you've considered

I considered to this audit at my proxy but it will split the audit to two different places

Version you're running

b71a753

Additional context

No response

Metadata

Metadata

Assignees

Labels

Projects

Status

In Development

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions