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
Copy file name to clipboardExpand all lines: api/observability/v1/output_types.go
+17-5Lines changed: 17 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1262,6 +1262,7 @@ type SplunkAuthentication struct {
1262
1262
1263
1263
// Splunk Deliver log data to Splunk’s HTTP Event Collector
1264
1264
// Provides optional extra properties for `type: splunk_hec` ('splunk_hec_logs' after Vector 0.23
1265
+
// +kubebuilder:validation:XValidation:rule="!has(self.sourceType) || has(self.payloadKey)",message="sourceType can only be set when payloadKey is defined"
1265
1266
typeSplunkstruct {
1266
1267
// Authentication sets credentials for authenticating the requests.
// SourceType can be used to specify a pretrained or custom sourcetype in Splunk.
1335
-
// If not specified, the Splunk source type used is `_json` but may be overridden when using `payloadKey`, depending on the structure of the final event payload.
1335
+
// SourceType can be used to specify a pretrained or custom source type in Splunk, but can only be set when PayloadKey is defined.
1336
+
//
1337
+
// WARNING: The administrator is responsible for configuring the pipeline so the source type matches the log entry. The collector makes no effort or validation to ensure they match.
1338
+
//
1339
+
// If SourceType is not specified, the source type used is `_json`. If using PayloadKey without SourceType, the source type used will be either `_json` or `generic_single_line`, depending on the structure of the final event payload.
// The SourceType can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value.
1343
+
// A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`.
1344
+
//
1345
+
// Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes.
Copy file name to clipboardExpand all lines: bundle/manifests/cluster-logging.clusterserviceversion.yaml
+15-5Lines changed: 15 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1943,17 +1943,27 @@ spec:
1943
1943
x-descriptors:
1944
1944
- urn:alm:descriptor:com.tectonic.ui:text
1945
1945
- description: |-
1946
-
SourceType can be used to specify a pretrained or custom sourcetype in Splunk.
1947
-
If not specified, the Splunk source type used is `_json` but may be overridden when using `payloadKey`, depending on the structure of the final event payload.
1946
+
SourceType can be used to specify a pretrained or custom source type in Splunk, but can only be set when PayloadKey is defined.
1947
+
1948
+
WARNING: The administrator is responsible for configuring the pipeline so the source type matches the log entry. The collector makes no effort or validation to ensure they match.
1949
+
1950
+
If SourceType is not specified, the source type used is `_json`. If using PayloadKey without SourceType, the source type used will be either `_json` or `generic_single_line`, depending on the structure of the final event payload.
The SourceType can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value.
1954
+
A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`.
1955
+
1956
+
Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes.
Copy file name to clipboardExpand all lines: bundle/manifests/observability.openshift.io_clusterlogforwarders.yaml
+19-5Lines changed: 19 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -3893,17 +3893,28 @@ spec:
3893
3893
type: string
3894
3894
sourceType:
3895
3895
description: |-
3896
-
SourceType can be used to specify a pretrained or custom sourcetype in Splunk.
3897
-
If not specified, the Splunk source type used is `_json` but may be overridden when using `payloadKey`, depending on the structure of the final event payload.
3896
+
SourceType can be used to specify a pretrained or custom source type in Splunk, but can only be set when PayloadKey is defined.
3897
+
3898
+
WARNING: The administrator is responsible for configuring the pipeline so the source type matches the log entry. The collector makes no effort or validation to ensure they match.
3899
+
3900
+
If SourceType is not specified, the source type used is `_json`. If using PayloadKey without SourceType, the source type used will be either `_json` or `generic_single_line`, depending on the structure of the final event payload.
The SourceType can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value.
3904
+
A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`.
3905
+
3906
+
Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes.
Copy file name to clipboardExpand all lines: config/crd/bases/observability.openshift.io_clusterlogforwarders.yaml
+19-5Lines changed: 19 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -3893,17 +3893,28 @@ spec:
3893
3893
type: string
3894
3894
sourceType:
3895
3895
description: |-
3896
-
SourceType can be used to specify a pretrained or custom sourcetype in Splunk.
3897
-
If not specified, the Splunk source type used is `_json` but may be overridden when using `payloadKey`, depending on the structure of the final event payload.
3896
+
SourceType can be used to specify a pretrained or custom source type in Splunk, but can only be set when PayloadKey is defined.
3897
+
3898
+
WARNING: The administrator is responsible for configuring the pipeline so the source type matches the log entry. The collector makes no effort or validation to ensure they match.
3899
+
3900
+
If SourceType is not specified, the source type used is `_json`. If using PayloadKey without SourceType, the source type used will be either `_json` or `generic_single_line`, depending on the structure of the final event payload.
The SourceType can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value.
3904
+
A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`.
3905
+
3906
+
Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes.
Copy file name to clipboardExpand all lines: config/manifests/bases/cluster-logging.clusterserviceversion.yaml
+15-5Lines changed: 15 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1866,17 +1866,27 @@ spec:
1866
1866
x-descriptors:
1867
1867
- urn:alm:descriptor:com.tectonic.ui:text
1868
1868
- description: |-
1869
-
SourceType can be used to specify a pretrained or custom sourcetype in Splunk.
1870
-
If not specified, the Splunk source type used is `_json` but may be overridden when using `payloadKey`, depending on the structure of the final event payload.
1869
+
SourceType can be used to specify a pretrained or custom source type in Splunk, but can only be set when PayloadKey is defined.
1870
+
1871
+
WARNING: The administrator is responsible for configuring the pipeline so the source type matches the log entry. The collector makes no effort or validation to ensure they match.
1872
+
1873
+
If SourceType is not specified, the source type used is `_json`. If using PayloadKey without SourceType, the source type used will be either `_json` or `generic_single_line`, depending on the structure of the final event payload.
The SourceType can be a combination of static and dynamic values consisting of field paths followed by `||` followed by another field path or a static value.
1877
+
A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`.
1878
+
1879
+
Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes.
Copy file name to clipboardExpand all lines: docs/features/logforwarding/outputs/splunk-forwarding.adoc
+63-76Lines changed: 63 additions & 76 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ spec:
54
54
2. `url`: The base URL of the Splunk instance.
55
55
3. `index`: Optional. The name of the index to send events to. If not specified, the default index defined within Splunk is used. This supports template syntax to allow dynamic per-event values.
56
56
4. `source`: Optional. The source of events sent to this sink. This supports template syntax to allow dynamic per-event values.
57
-
5. `sourceType`: Optional. Can be used to specify a pretrained or custom sourcetype in Splunk. If not specified it will default to `_json` and be detected by .payloadkey.
57
+
5. `sourceType`: Optional. Can be used to specify a https://help.splunk.com/en/splunk-enterprise/get-started/get-data-in/10.2/configure-source-types/list-of-pretrained-source-types[pretrained] or custom sourcetype in Splunk when the payloadKey is additionally defined. If not specified, it will default to `_json`.
58
58
6. `indexedFields`: Optional. Fields to be added to Splunk index.
59
59
7. `payloadKey`: Optional. Specifies record field to use as payload.
60
60
8. `compression`: Optional. Compression configuration, available to are: `none`, `gzip`. Default is `none`.
@@ -67,88 +67,76 @@ following Cluster Log Forwarder's conventions.
67
67
=== `sourceType`
68
68
In Splunk, the source type is used to define how incoming data should be parsed, interpreted, and categorised. Splunk includes many built-in source types and also allows for custom source types to be defined. The `sourceType` field should reference a source type configured in Splunk.
69
69
70
-
If not specified, the Splunk source type used is `_json` but may be overridden when using `payloadKey`, depending on the structure of the final event payload.
70
+
This field must be used in combination with `payloadKey`.
71
71
72
-
An example of a use case for this field is where a custom Splunk source type has been created to interpret particular log message content where key/value pairs are extracted and transformed into Splunk fields for use with dashboards.
72
+
If `sourceType` is not specified, the source type used is `_json`. If using `payloadKey` without `sourceType`, the source type used will be either `_json` or `generic_single_line`, depending on the structure of the final event payload.
73
73
74
-
Here is an example of a CLF where log events for an app are forwarded to a Splunk output sink with a user-defined source type :
74
+
WARNING: The administrator is responsible for configuring the pipeline so the source type matches the log entry. The collector makes no effort or validation to ensure they match.
75
75
76
-
```
76
+
The `sourceType` field can be defined in the CLF as a templated field to get its value from the stuctured log event, such as a pod label.
77
+
78
+
Below is an example of a pod which defines the source type to use in a label named `splunk_sourcetype`:
79
+
80
+
[source,yaml]
81
+
----
82
+
apiVersion: v1
83
+
kind: Pod
84
+
metadata:
85
+
name: myapp
86
+
labels:
87
+
app: myapp
88
+
splunk_sourcetype: log4j
77
89
spec:
78
-
inputs:
79
-
- application:
80
-
includes:
81
-
- container: myapp
82
-
namespace: my-app-*
83
-
name: myapp
84
-
type: application
85
-
outputs:
86
-
- name: splunk-myapp
87
-
splunk:
88
-
authentication:
89
-
token:
90
-
key: hecToken
91
-
secretName: splunk-myapp
92
-
sourceType: 'myapp:sourcetype'
93
-
url: 'https://splunk.customer.com:8088'
94
-
type: splunk
95
-
pipelines:
90
+
containers:
96
91
- name: myapp
97
-
inputRefs:
98
-
- myapp
99
-
outputRefs:
100
-
- splunk-myapp
101
-
```
102
-
103
-
If a source type needs to be referenced for a particular application's log events, but is not appropriate for others, be sure to structure the ClusterLogFowarder so that it does not misrepresent the format of log events by using a single Splunk output sink.
92
+
image: myapp:latest
93
+
ports:
94
+
- containerPort: 80
95
+
----
104
96
105
-
Here is an example of a CLF where cluster-wide general app log events are forwarded to a Splunk output sink using the default source type of `_json`, and log events for an app are forwarded to a different Splunk output sink with a user-defined source type :
97
+
Below is an example of the CLF which sets `payloadKey` to `.message` and uses a template to set the `sourceType` to match the `splunk_sourcetype` pod label. If the label does not exist, the source type of "generic_single_line" will be used, which is a built-in Splunk source type.
By default, `payloadKey` is not set, which means the complete log record is forwarded as the payload.
243
+
By default, `payloadKey` is not set, which means the complete log event payload is forwarded. This field can be used to narrow down the final payload to a specific field within the log event. For example, for the payload to contain only the log message, payloadKey should be set to `.message`.
256
244
257
-
If `sourceType` is not defined, payloadKey can override the default `sourcetype` value of `_json` :
245
+
Unless `sourceType` has been defined, the selected `payloadKey` field will be checked and a Splunk source type will be nominated :
258
246
259
-
* `sourceType`:
247
+
* Splunk source type:
260
248
** `_json` — used when `payloadKey` points to an object.
261
249
** `generic_single_line` — used when the payload is a primitive value (e.g., string, number, boolean).
262
250
263
251
NOTE: Use `payloadKey` carefully. Selecting a single field as the payload may cause other important information in the log to be dropped, potentially leading to inconsistent or incomplete log events.
264
252
265
-
266
253
=== `host`
267
254
268
255
The `host` field is *not configurable* through the Cluster Log Forwarder API.
0 commit comments