You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(k8saudit): use event-driven file watching with fsnotify
Replace polling-based file watching with fsnotify for better efficiency.
Key changes:
- Use fsnotify to watch parent directory (per maintainer recommendation)
- Rename scheme from tail:// to file://
- Remove watchPollIntervalMs config (no longer needed)
- Rename test package from tail to filewatch
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: plugins/k8saudit/README.md
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ Audit events are logged by the API server when almost every cluster management t
9
9
10
10
This plugin supports consuming Kubernetes Audit Events coming from the [Webhook backend](https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/#webhook-backend) or from a file. For webhooks, the plugin embeds a web server that listens on a configurable port and accepts POST requests. The posted JSON object comprises one or more events. The web server of the plugin can be configured as part of the plugin's init configuration and open parameters. For files, the plugin expects content to be in [JSONL format](https://jsonlines.org/), where each line represents a JSON object, containing one or more audit events.
11
11
12
-
The expected way of using the plugin with Falco is through a Webhook. File reading support can be used with Stratoshark or testing and development. The `tail://` scheme enables continuous file watching with log rotation support, useful for reading audit logs written to disk by the API server.
12
+
The expected way of using the plugin with Falco is through a Webhook. File reading support can be used with Stratoshark or testing and development. The `file://` scheme enables continuous file watching with log rotation support, useful for reading audit logs written to disk by the API server.
- `maxEventSize`: Maximum size of single audit event (Default: 262144)
132
132
- `webhookMaxBatchSize`: Maximum size of incoming webhook POST request bodies (Default: 12582912)
133
133
- `useAsync`: If true, then async extraction optimization is enabled (Default: true)
134
-
- `watchPollIntervalMs`: Polling interval in milliseconds when watching a file with the `tail://` scheme (Default: 250)
135
134
136
135
**Open Parameters**:
137
136
- `http://<host>:<port>/<endpoint>`: Opens an event stream by listening on an HTTP web server
138
137
- `https://<host>:<port>/<endpoint>`: Opens an event stream by listening on an HTTPS web server
139
-
- `tail://<filepath>`: Opens an event stream by continuously watching a file for new audit events, similar to `tail -f`. Handles log rotation (inode changes) and file truncation automatically. Example: `tail:///var/log/kube-apiserver/audit.log`
138
+
- `file://<filepath>`: Opens an event stream by continuously watching a file for new audit events. Handles log rotation automatically. Example: `file:///var/log/kube-apiserver/audit.log`
140
139
- `no scheme`: Opens an event stream by reading the events from a file on the local filesystem. The params string is interpreted as a filepath
Copy file name to clipboardExpand all lines: plugins/k8saudit/pkg/k8saudit/config.go
-2Lines changed: 0 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,6 @@ type PluginConfig struct {
24
24
UseAsyncbool`json:"useAsync" jsonschema:"title=Use async extraction,description=If true then async extraction optimization is enabled (Default: true),default=true"`
25
25
MaxEventSizeuint64`json:"maxEventSize" jsonschema:"title=Maximum event size,description=Maximum size of single audit event (Default: 262144),default=262144"`
26
26
WebhookMaxBatchSizeuint64`json:"webhookMaxBatchSize" jsonschema:"title=Maximum webhook request size,description=Maximum size of incoming webhook POST request bodies (Default: 12582912),default=12582912"`
27
-
WatchPollIntervalMsuint64`json:"watchPollIntervalMs" jsonschema:"title=Watch poll interval,description=Polling interval in milliseconds when watching a file with tail:// scheme (Default: 250),default=250"`
28
27
}
29
28
30
29
// Resets sets the configuration to its default values
0 commit comments