Skip to content

Commit 43febcf

Browse files
authored
Merge pull request #48666 from libander/RHDEVDOCS-4029
RHDEVDOCS-4029 - Fowarding to separate indices
2 parents 3ee4d60 + ce7ec6a commit 43febcf

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

logging/cluster-logging-external.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ You cannot use the config map methods and the Cluster Log Forwarder in the same
2929

3030
include::modules/cluster-logging-collector-log-forwarding-about.adoc[leveloffset=+1]
3131

32+
include::modules/cluster-logging-forwarding-separate-indices.adoc[leveloffset=+1]
33+
3234
include::modules/cluster-logging-collector-log-forwarding-supported-plugins-5-1.adoc[leveloffset=+1]
3335

3436
include::modules/cluster-logging-collector-log-forwarding-supported-plugins-5-2.adoc[leveloffset=+1]
@@ -42,6 +44,7 @@ include::modules/cluster-logging-collector-log-forward-syslog.adoc[leveloffset=+
4244
include::modules/cluster-logging-collector-log-forward-cloudwatch.adoc[leveloffset=+1]
4345

4446
include::modules/cluster-logging-collector-log-forward-loki.adoc[leveloffset=+1]
47+
4548
include::modules/cluster-logging-troubleshooting-loki-entry-out-of-order-errors.adoc[leveloffset=+2]
4649

4750

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Module is included in the following assemblies:
2+
//cluster-logging-external
3+
:_content-type: PROCEDURE
4+
[id="cluster-logging-forwarding-separate-indices_{context}"]
5+
= Forwarding JSON logs from containers in the same pod to separate indices
6+
7+
You can forward structured logs from different containers within the same pod to different indices. To use this feature, you must configure the pipeline with multi-container support and annotate the pods. Logs are written to indices with a prefix of `app-`. It is recommended that Elasticsearch be configured with aliases to accommodate this.
8+
9+
[IMPORTANT]
10+
====
11+
JSON formatting of logs varies by application. Because creating too many indices impacts performance, limit your use of this feature to creating indices for logs that have incompatible JSON formats. Use queries to separate logs from different namespaces, or applications with compatible JSON formats.
12+
====
13+
14+
.Prerequisites
15+
16+
* {logging-title-uc}: 5.5
17+
18+
.Procedure
19+
. Create or edit a YAML file that defines the `ClusterLogForwarder` CR object:
20+
+
21+
[source,yaml]
22+
----
23+
apiVersion: "logging.openshift.io/v1"
24+
kind: ClusterLogForwarder
25+
metadata:
26+
name: instance
27+
namespace: openshift-logging
28+
spec:
29+
outputDefaults:
30+
elasticsearch:
31+
enableStructuredContainerLogs: true <1>
32+
pipelines:
33+
- inputRefs:
34+
- application
35+
name: application-logs
36+
outputRefs:
37+
- default
38+
parse: json
39+
----
40+
<1> Enables multi-container outputs.
41+
42+
. Create or edit a YAML file that defines the `Pod` CR object:
43+
+
44+
[source,yaml]
45+
----
46+
apiVersion: v1
47+
kind: Pod
48+
metadata:
49+
annotations:
50+
containerType.logging.openshift.io/heavy: heavy <1>
51+
containerType.logging.openshift.io/low: low
52+
spec:
53+
containers:
54+
- name: heavy <2>
55+
image: heavyimage
56+
- name: low
57+
image: lowimage
58+
----
59+
<1> Format: `containerType.logging.openshift.io/<container-name>: <index>`
60+
<2> Annotation names must match container names
61+
62+
[WARNING]
63+
====
64+
This configuration might significantly increase the number of shards on the cluster.
65+
====
66+
67+
.Additional Resources
68+
link:https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/[Kubernetes Annotations]

0 commit comments

Comments
 (0)