Skip to content

Commit e7d6417

Browse files
authored
implement audit logging configuration (#217)
* introduce strucutres for configuring audit logging * make gen * review: defaults
1 parent d1ba8d5 commit e7d6417

File tree

5 files changed

+188
-0
lines changed

5 files changed

+188
-0
lines changed

api/v1/qdrantcluster_types.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,9 @@ type QdrantConfiguration struct {
464464
// Inference configuration. This is used in Qdrant Managed Cloud only. If not set Inference is not available to this cluster.
465465
// +optional
466466
Inference *InferenceConfig `json:"inference,omitempty"`
467+
// Audit specifies the audit logging configuration for Qdrant.
468+
// +optional
469+
Audit *AuditConfig `json:"audit,omitempty"`
467470
}
468471

469472
type InferenceConfig struct {
@@ -473,6 +476,43 @@ type InferenceConfig struct {
473476
Enabled bool `json:"enabled"`
474477
}
475478

479+
// AuditRotation specifies the rotation interval for audit log files.
480+
// +kubebuilder:validation:Enum=daily;hourly
481+
type AuditRotation string
482+
483+
const (
484+
AuditRotationDaily AuditRotation = "daily"
485+
AuditRotationHourly AuditRotation = "hourly"
486+
)
487+
488+
// AuditConfig specifies the audit logging configuration for Qdrant.
489+
type AuditConfig struct {
490+
// Enabled specifies whether to enable audit logging.
491+
// +kubebuilder:default=false
492+
// +optional
493+
Enabled bool `json:"enabled"`
494+
// Dir specifies the directory to write audit log files into.
495+
// Default is `./storage/audit`
496+
// +optional
497+
Dir *string `json:"dir,omitempty"`
498+
// Rotation specifies the rotation interval: "daily" (default) or "hourly".
499+
// +kubebuilder:default=daily
500+
// +optional
501+
Rotation *AuditRotation `json:"rotation,omitempty"`
502+
// MaxLogFiles specifies the maximum number of rotated audit log files to keep.
503+
// Older files are deleted when a new log file is created. Default: 7.
504+
// +kubebuilder:default=7
505+
// +kubebuilder:validation:Minimum=1
506+
// +optional
507+
MaxLogFiles *int64 `json:"max_log_files,omitempty"`
508+
// TrustForwardedHeaders specifies whether to use X-Forwarded-For header to
509+
// determine the client address recorded in audit log entries. Only enable
510+
// this when running behind a trusted reverse proxy or load balancer.
511+
// Default is false.
512+
// +optional
513+
TrustForwardedHeaders bool `json:"trust_forwarded_headers"`
514+
}
515+
476516
type StorageConfig struct {
477517
// Performance configuration
478518
// +optional

api/v1/zz_generated.deepcopy.go

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/qdrant-kubernetes-api/templates/region-crds/qdrant.io_qdrantclusters.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,43 @@ spec:
6767
description: Config specifies the Qdrant configuration setttings for
6868
the clusters.
6969
properties:
70+
audit:
71+
description: Audit specifies the audit logging configuration for
72+
Qdrant.
73+
properties:
74+
dir:
75+
description: |-
76+
Dir specifies the directory to write audit log files into.
77+
Default is `./storage/audit`
78+
type: string
79+
enabled:
80+
default: false
81+
description: Enabled specifies whether to enable audit logging.
82+
type: boolean
83+
max_log_files:
84+
default: 7
85+
description: |-
86+
MaxLogFiles specifies the maximum number of rotated audit log files to keep.
87+
Older files are deleted when a new log file is created. Default: 7.
88+
format: int64
89+
minimum: 1
90+
type: integer
91+
rotation:
92+
default: daily
93+
description: 'Rotation specifies the rotation interval: "daily"
94+
(default) or "hourly".'
95+
enum:
96+
- daily
97+
- hourly
98+
type: string
99+
trust_forwarded_headers:
100+
description: |-
101+
TrustForwardedHeaders specifies whether to use X-Forwarded-For header to
102+
determine the client address recorded in audit log entries. Only enable
103+
this when running behind a trusted reverse proxy or load balancer.
104+
Default is false.
105+
type: boolean
106+
type: object
70107
collection:
71108
description: Collection specifies the default collection configuration
72109
for Qdrant.

crds/qdrant.io_qdrantclusters.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,43 @@ spec:
6666
description: Config specifies the Qdrant configuration setttings for
6767
the clusters.
6868
properties:
69+
audit:
70+
description: Audit specifies the audit logging configuration for
71+
Qdrant.
72+
properties:
73+
dir:
74+
description: |-
75+
Dir specifies the directory to write audit log files into.
76+
Default is `./storage/audit`
77+
type: string
78+
enabled:
79+
default: false
80+
description: Enabled specifies whether to enable audit logging.
81+
type: boolean
82+
max_log_files:
83+
default: 7
84+
description: |-
85+
MaxLogFiles specifies the maximum number of rotated audit log files to keep.
86+
Older files are deleted when a new log file is created. Default: 7.
87+
format: int64
88+
minimum: 1
89+
type: integer
90+
rotation:
91+
default: daily
92+
description: 'Rotation specifies the rotation interval: "daily"
93+
(default) or "hourly".'
94+
enum:
95+
- daily
96+
- hourly
97+
type: string
98+
trust_forwarded_headers:
99+
description: |-
100+
TrustForwardedHeaders specifies whether to use X-Forwarded-For header to
101+
determine the client address recorded in audit log entries. Only enable
102+
this when running behind a trusted reverse proxy or load balancer.
103+
Default is false.
104+
type: boolean
105+
type: object
69106
collection:
70107
description: Collection specifies the default collection configuration
71108
for Qdrant.

docs/api.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,44 @@ Package v1 contains API Schema definitions for the qdrant.io v1 API group
7676

7777

7878

79+
#### AuditConfig
80+
81+
82+
83+
AuditConfig specifies the audit logging configuration for Qdrant.
84+
85+
86+
87+
_Appears in:_
88+
- [QdrantConfiguration](#qdrantconfiguration)
89+
90+
| Field | Description | Default | Validation |
91+
| --- | --- | --- | --- |
92+
| `enabled` _boolean_ | Enabled specifies whether to enable audit logging. | false | Optional: \{\} <br /> |
93+
| `dir` _string_ | Dir specifies the directory to write audit log files into.<br />Default is `./storage/audit` | | Optional: \{\} <br /> |
94+
| `rotation` _[AuditRotation](#auditrotation)_ | Rotation specifies the rotation interval: "daily" (default) or "hourly". | daily | Enum: [daily hourly] <br />Optional: \{\} <br /> |
95+
| `max_log_files` _integer_ | MaxLogFiles specifies the maximum number of rotated audit log files to keep.<br />Older files are deleted when a new log file is created. Default: 7. | 7 | Minimum: 1 <br />Optional: \{\} <br /> |
96+
| `trust_forwarded_headers` _boolean_ | TrustForwardedHeaders specifies whether to use X-Forwarded-For header to<br />determine the client address recorded in audit log entries. Only enable<br />this when running behind a trusted reverse proxy or load balancer.<br />Default is false. | | Optional: \{\} <br /> |
97+
98+
99+
#### AuditRotation
100+
101+
_Underlying type:_ _string_
102+
103+
AuditRotation specifies the rotation interval for audit log files.
104+
105+
_Validation:_
106+
- Enum: [daily hourly]
107+
108+
_Appears in:_
109+
- [AuditConfig](#auditconfig)
110+
111+
| Field | Description |
112+
| --- | --- |
113+
| `daily` | |
114+
| `hourly` | |
115+
116+
79117

80118

81119
#### ClusterManagerReponse
@@ -948,6 +986,7 @@ _Appears in:_
948986
| `tls` _[QdrantConfigurationTLS](#qdrantconfigurationtls)_ | TLS specifies the TLS configuration for Qdrant. | | Optional: \{\} <br /> |
949987
| `storage` _[StorageConfig](#storageconfig)_ | Storage specifies the storage configuration for Qdrant. | | Optional: \{\} <br /> |
950988
| `inference` _[InferenceConfig](#inferenceconfig)_ | Inference configuration. This is used in Qdrant Managed Cloud only. If not set Inference is not available to this cluster. | | Optional: \{\} <br /> |
989+
| `audit` _[AuditConfig](#auditconfig)_ | Audit specifies the audit logging configuration for Qdrant. | | Optional: \{\} <br /> |
951990

952991

953992
#### QdrantConfigurationCollection

0 commit comments

Comments
 (0)