Skip to content

Commit 2b792c8

Browse files
authored
Merge pull request #95250 from eromanova97/OBSDOCS-2036
OBSDOCS-2038: fix 'Overview of API audit filter' and remove duplicate
2 parents bd8fe27 + e3991fb commit 2b792c8

File tree

4 files changed

+35
-138
lines changed

4 files changed

+35
-138
lines changed

configuring/configuring-log-forwarding.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ include::modules/enabling-multi-line-exception-detection.adoc[leveloffset=+2]
117117
include::modules/logging-http-forward.adoc[leveloffset=+2]
118118
include::modules/cluster-logging-collector-log-forward-syslog.adoc[leveloffset=+2]
119119
include::modules/content-filter-drop-records.adoc[leveloffset=+2]
120-
include::modules/audit-filtering.adoc[leveloffset=+2]
120+
include::modules/logging-audit-log-filtering.adoc[leveloffset=+2]
121121
include::modules/input-spec-filter-labels-expressions.adoc[leveloffset=+2]
122122
include::modules/logging-content-filter-prune-records.adoc[leveloffset=+2]
123123
include::modules/input-spec-filter-audit-infrastructure.adoc[leveloffset=+1]

log_collection_forwarding/cluster-logging-collector.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ include::modules/log-collector-http-server.adoc[leveloffset=+2]
3030

3131
[role="_additional-resources"]
3232
.Additional resources
33-
* xref:../log_collection_forwarding/configuring-log-forwarding.adoc#logging-audit-filtering_configuring-log-forwarding[Overview of API audit filter]
33+
* xref:../log_collection_forwarding/configuring-log-forwarding.adoc#logging-audit-log-filtering_configuring-log-forwarding[API audit filter overview]
3434

3535
include::modules/cluster-logging-collector-tuning.adoc[leveloffset=+1]

modules/audit-filtering.adoc

Lines changed: 0 additions & 115 deletions
This file was deleted.

modules/logging-audit-log-filtering.adoc

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,70 @@
11
// Module included in the following assemblies:
22
//
33
// * observability/logging/log_collection_forwarding/configuring-log-forwarding.adoc
4+
// * configuring/configuring-log-forwarding.adoc
45

56
:_mod-docs-content-type: CONCEPT
6-
[id="logging-audit-filtering_{context}"]
7-
= Overview of API audit filter
8-
OpenShift API servers generate audit events for each API call, detailing the request, response, and the identity of the requester, leading to large volumes of data. The API Audit filter uses rules to enable the exclusion of non-essential events and the reduction of event size, facilitating a more manageable audit trail. Rules are checked in order, checking stops at the first match. How much data is included in an event is determined by the value of the `level` field:
7+
[id="logging-audit-log-filtering_{context}"]
8+
= API audit filter overview
99

10-
* `None`: The event is dropped.
11-
* `Metadata`: Audit metadata is included, request and response bodies are removed.
12-
* `Request`: Audit metadata and the request body are included, the response body is removed.
13-
* `RequestResponse`: All data is included: metadata, request body and response body. The response body can be very large. For example, `oc get pods -A` generates a response body containing the YAML description of every pod in the cluster.
10+
OpenShift API servers generate audit events for every API call. These events include details about the request, the response, and the identity of the requester. This can lead to large volumes of data.
11+
12+
The API audit filter helps manage the audit trail by using rules to exclude non-essential events and to reduce the event size. Rules are checked in order, and checking stops at the first match. The amount of data in an event depends on the value of the `level` field:
1413

14+
* `None`: The event is dropped.
15+
* `Metadata`: The event includes audit metadata and excludes request and response bodies.
16+
* `Request`: The event includes audit metadata and the request body, and excludes the response body.
17+
* `RequestResponse`: The event includes all data: metadata, request body and response body. The response body can be very large. For example, `oc get pods -A` generates a response body containing the YAML description of every pod in the cluster.
1518
1619
[NOTE]
1720
====
18-
You can use this feature only if the Vector collector is set up in your logging deployment.
21+
You can only use the API audit filter feature if the Vector collector is set up in your logging deployment.
1922
====
2023

21-
In logging 5.8 and later, the `ClusterLogForwarder` custom resource (CR) uses the same format as the standard link:https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/#audit-policy[Kubernetes audit policy], while providing the following additional functions:
24+
The `ClusterLogForwarder` custom resource (CR) uses the same format as the standard link:https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/#audit-policy[Kubernetes audit policy]. The `ClusterLogForwarder` CR provides the following additional functions:
2225

23-
Wildcards:: Names of users, groups, namespaces, and resources can have a leading or trailing `\*` asterisk character. For example, namespace `openshift-\*` matches `openshift-apiserver` or `openshift-authentication`. Resource `\*/status` matches `Pod/status` or `Deployment/status`.
26+
Wildcards:: Names of users, groups, namespaces, and resources can have a leading or trailing `\*` asterisk character. For example, the `openshift-\*` namespace matches `openshift-apiserver` or `openshift-authentication` namespaces. The `\*/status` resource matches `Pod/status` or `Deployment/status` resources.
2427

2528
Default Rules:: Events that do not match any rule in the policy are filtered as follows:
26-
* Read-only system events such as `get`, `list`, `watch` are dropped.
29+
+
30+
--
31+
* Read-only system events such as `get`, `list`, and `watch` are dropped.
2732
* Service account write events that occur within the same namespace as the service account are dropped.
2833
* All other events are forwarded, subject to any configured rate limits.
29-
34+
--
35+
+
3036
To disable these defaults, either end your rules list with a rule that has only a `level` field or add an empty rule.
3137

32-
Omit Response Codes:: A list of integer status codes to omit. You can drop events based on the HTTP status code in the response by using the `OmitResponseCodes` field, a list of HTTP status code for which no events are created. The default value is `[404, 409, 422, 429]`. If the value is an empty list, `[]`, then no status codes are omitted.
38+
Omit Response Codes:: A list of integer status codes to omit. You can drop events based on the HTTP status code in the response by using the `OmitResponseCodes` field, which lists HTTP status codes for which no events are created. The default value is `[404, 409, 422, 429]`. If the value is an empty list, `[]`, no status codes are omitted.
3339

3440
The `ClusterLogForwarder` CR audit policy acts in addition to the {ocp-product-title} audit policy. The `ClusterLogForwarder` CR audit filter changes what the log collector forwards, and provides the ability to filter by verb, user, group, namespace, or resource. You can create multiple filters to send different summaries of the same audit stream to different places. For example, you can send a detailed stream to the local cluster log store, and a less detailed stream to a remote site.
3541

36-
[NOTE]
37-
====
38-
The example provided is intended to illustrate the range of rules possible in an audit policy and is not a recommended configuration.
42+
[IMPORTANT]
3943
====
44+
* You must have the `collect-audit-logs` cluster role to collect the audit logs.
4045
46+
* The following example provided is intended to illustrate the range of rules possible in an audit policy and is not a recommended configuration.
47+
====
4148

4249
.Example audit policy
4350
[source,yaml]
4451
----
45-
apiVersion: logging.openshift.io/v1
52+
apiVersion: observability.openshift.io/v1
4653
kind: ClusterLogForwarder
4754
metadata:
4855
name: instance
4956
namespace: openshift-logging
5057
spec:
58+
serviceAccount:
59+
name: example-service-account
5160
pipelines:
5261
- name: my-pipeline
53-
inputRefs: audit #<1>
54-
filterRefs: my-policy #<2>
55-
outputRefs: default
62+
inputRefs:
63+
- audit # <1>
64+
filterRefs:
65+
- my-policy # <2>
66+
outputRefs:
67+
- my-output
5668
filters:
5769
- name: my-policy
5870
type: kubeAPIAudit
@@ -120,5 +132,5 @@ spec:
120132
# A catch-all rule to log all other requests at the Metadata level.
121133
- level: Metadata
122134
----
123-
<1> The log types that are collected. The value for this field can be `audit` for audit logs, `application` for application logs, `infrastructure` for infrastructure logs, or a named input that has been defined for your application.
135+
<1> The collected log types. The value for this field can be `audit` for audit logs, `application` for application logs, `infrastructure` for infrastructure logs, or a named input that is defined for your application.
124136
<2> The name of your audit policy.

0 commit comments

Comments
 (0)