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
= Forwarding logs to an external Elasticsearch instance
4
8
5
-
You can optionally forward logs to an external Elasticsearch instance in addition to, or instead of, the internal {product-title} Elasticsearch instance. You are responsible for configuring the external log aggregator to receive log data from {product-title}.
9
+
You can forward logs to an external Elasticsearch instance in addition to, or instead of, the internal log store. You are responsible for configuring the external log aggregator to receive log data from {product-title}.
6
10
7
11
To configure log forwarding to an external Elasticsearch instance, you must create a `ClusterLogForwarder` custom resource (CR) with an output to that instance, and a pipeline that uses the output. The external Elasticsearch output can use the HTTP (insecure) or HTTPS (secure HTTP) connection.
8
12
9
-
To forward logs to both an external and the internal Elasticsearch instance, create outputs and pipelines to the external instance and a pipeline that uses the `default` output to forward logs to the internal instance. You do not need to create a `default` output. If you do configure a `default` output, you receive an error message because the `default` output is reserved for the {clo}.
13
+
To forward logs to both an external and the internal Elasticsearch instance, create outputs and pipelines to the external instance and a pipeline that uses the `default` output to forward logs to the internal instance.
10
14
11
15
[NOTE]
12
16
====
13
-
If you want to forward logs to *only* the internal {product-title} Elasticsearch instance, you do not need to create a `ClusterLogForwarder` CR.
17
+
If you only want to forward logs to an internal Elasticsearch instance, you do not need to create a `ClusterLogForwarder` CR.
14
18
====
15
19
16
20
.Prerequisites
@@ -19,68 +23,57 @@ If you want to forward logs to *only* the internal {product-title} Elasticsearch
19
23
20
24
.Procedure
21
25
22
-
. Create or edit a YAML file that defines the `ClusterLogForwarder` CR object:
26
+
. Create or edit a YAML file that defines the `ClusterLogForwarder` CR:
23
27
+
28
+
.Example `ClusterLogForwarder` CR
24
29
[source,yaml]
25
30
----
26
31
apiVersion: logging.openshift.io/v1
27
32
kind: ClusterLogForwarder
28
33
metadata:
29
-
name: <log_forwarder_name> <1>
30
-
namespace: <log_forwarder_namespace> <2>
34
+
name: <log_forwarder_name> # <1>
35
+
namespace: <log_forwarder_namespace> # <2>
31
36
spec:
32
-
serviceAccountName: <service_account_name> <3>
37
+
serviceAccountName: <service_account_name> # <3>
33
38
outputs:
34
-
- name: elasticsearch-insecure <4>
35
-
type: "elasticsearch" <5>
36
-
url: http://elasticsearch.insecure.com:9200 <6>
37
-
- name: elasticsearch-secure
38
-
type: "elasticsearch"
39
-
url: https://elasticsearch.secure.com:9200 <7>
39
+
- name: elasticsearch-example # <4>
40
+
type: elasticsearch # <5>
41
+
elasticsearch:
42
+
version: 8 # <6>
43
+
url: http://elasticsearch.example.com:9200 # <7>
40
44
secret:
41
-
name: es-secret <8>
45
+
name: es-secret # <8>
42
46
pipelines:
43
-
- name: application-logs <9>
44
-
inputRefs: <10>
47
+
- name: application-logs # <9>
48
+
inputRefs: # <10>
45
49
- application
46
50
- audit
47
51
outputRefs:
48
-
- elasticsearch-secure <11>
49
-
- default <12>
50
-
labels:
51
-
myLabel: "myValue" <13>
52
-
- name: infrastructure-audit-logs <14>
53
-
inputRefs:
54
-
- infrastructure
55
-
outputRefs:
56
-
- elasticsearch-insecure
52
+
- elasticsearch-example # <11>
53
+
- default # <12>
57
54
labels:
58
-
logs: "audit-infra"
55
+
myLabel: "myValue" # <13>
56
+
# ...
59
57
----
60
58
<1> In legacy implementations, the CR name must be `instance`. In multi log forwarder implementations, you can use any name.
61
59
<2> In legacy implementations, the CR namespace must be `openshift-logging`. In multi log forwarder implementations, you can use any namespace.
62
60
<3> The name of your service account. The service account is only required in multi log forwarder implementations if the log forwarder is not deployed in the `openshift-logging` namespace.
63
61
<4> Specify a name for the output.
64
62
<5> Specify the `elasticsearch` type.
65
-
<6> Specify the URL and port of the external Elasticsearch instance as a valid absolute URL. You can use the `http` (insecure) or `https` (secure HTTP) protocol. If the cluster-wide proxy using the CIDR annotation is enabled, the output must be a server name or FQDN, not an IP Address.
66
-
<7> For a secure connection, you can specify an `https`or `http` URL that you authenticate by specifying a `secret`.
63
+
<6> Specify the Elasticsearch version. This can be `6`, `7`, or `8`.
64
+
<7> Specify the URL and port of the external Elasticsearch instance as a valid absolute URL. You can use the `http` (insecure) or `https` (secure HTTP) protocol. If the cluster-wide proxy using the CIDR annotation is enabled, the output must be a server name or FQDN, not an IP Address.
67
65
<8> For an `https` prefix, specify the name of the secret required by the endpoint for TLS communication. The secret must contain a `ca-bundle.crt` key that points to the certificate it represents. Otherwise, for `http` and `https` prefixes, you can specify a secret that contains a username and password. In legacy implementations, the secret must exist in the `openshift-logging` project. For more information, see the following "Example: Setting a secret that contains a username and password."
68
66
<9> Optional: Specify a name for the pipeline.
69
67
<10> Specify which log types to forward by using the pipeline: `application,``infrastructure`, or `audit`.
70
68
<11> Specify the name of the output to use when forwarding logs with this pipeline.
71
69
<12> Optional: Specify the `default` output to send the logs to the internal Elasticsearch instance.
72
70
<13> Optional: String. One or more labels to add to the logs.
73
-
<14> Optional: Configure multiple outputs to forward logs to other external log aggregators of any supported type:
74
-
** A name to describe the pipeline.
75
-
** The `inputRefs` is the log type to forward by using the pipeline: `application,``infrastructure`, or `audit`.
76
-
** The `outputRefs` is the name of the output to use.
77
-
** Optional: String. One or more labels to add to the logs.
78
71
79
-
. Create the CR object:
72
+
. Apply the `ClusterLogForwarder` CR:
80
73
+
81
74
[source,terminal]
82
75
----
83
-
$ oc create -f <file-name>.yaml
76
+
$ oc apply -f <filename>.yaml
84
77
----
85
78
86
79
.Example: Setting a secret that contains a username and password
@@ -100,6 +93,7 @@ metadata:
100
93
data:
101
94
username: <username>
102
95
password: <password>
96
+
# ...
103
97
----
104
98
105
99
. Create the secret:
@@ -124,16 +118,17 @@ spec:
124
118
url: https://elasticsearch.secure.com:9200
125
119
secret:
126
120
name: openshift-test-secret
121
+
# ...
127
122
----
128
123
+
129
124
[NOTE]
130
125
====
131
126
In the value of the `url` field, the prefix can be `http` or `https`.
0 commit comments