|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * configuring/cluster-logging-collector.adoc |
| 4 | + |
| 5 | + |
| 6 | +:_newdoc-version: 2.18.4 |
| 7 | +:_template-generated: 2025-08-05 |
| 8 | +:_mod-docs-content-type: PROCEDURE |
| 9 | + |
| 10 | +[id="configuring-the-collector-to-listen-for-connections-as-a-syslog-server_{context}"] |
| 11 | += Configuring the collector to listen for connections as a syslog server |
| 12 | + |
| 13 | +You can configure your log collector to collect journal format infrastructure logs by specifying `syslog` as a receiver input in the `ClusterLogForwarder` custom resource (CR). |
| 14 | + |
| 15 | +:feature-name: Syslog receiver input |
| 16 | +include::snippets/logging-http-sys-input-support.adoc[] |
| 17 | + |
| 18 | +Prerequisites |
| 19 | + |
| 20 | +* You have administrator permissions. |
| 21 | +* You have installed the {oc-first}. |
| 22 | +* You have installed the {clo}. |
| 23 | + |
| 24 | +.Procedure |
| 25 | + |
| 26 | +. Grant the `collect-infrastructure-logs` cluster role to the service account by running the following command: |
| 27 | ++ |
| 28 | +.Example binding command |
| 29 | +[source,terminal] |
| 30 | +---- |
| 31 | +$ oc adm policy add-cluster-role-to-user collect-infrastructure-logs -z logcollector |
| 32 | +---- |
| 33 | + |
| 34 | +. Modify the `ClusterLogForwarder` CR to add configuration for the `syslog` receiver input: |
| 35 | ++ |
| 36 | +.Example `ClusterLogForwarder` CR |
| 37 | +[source,yaml] |
| 38 | +---- |
| 39 | +apiVersion: observability.openshift.io/v1 |
| 40 | +kind: ClusterLogForwarder |
| 41 | +metadata: |
| 42 | + name: <clusterlogforwarder_name> #<1> |
| 43 | + namespace: <namespace> |
| 44 | +# ... |
| 45 | +spec: |
| 46 | + serviceAccount: |
| 47 | + name: <service_account_name> # <1> |
| 48 | + inputs: |
| 49 | + - name: syslog-receiver # <2> |
| 50 | + type: receiver |
| 51 | + receiver: |
| 52 | + type: syslog # <3> |
| 53 | + port: 10514 # <4> |
| 54 | + outputs: |
| 55 | + - name: <output_name> |
| 56 | + lokiStack: |
| 57 | + authentication: |
| 58 | + token: |
| 59 | + from: serviceAccount |
| 60 | + target: |
| 61 | + name: logging-loki |
| 62 | + namespace: openshift-logging |
| 63 | + tls: # <5> |
| 64 | + ca: |
| 65 | + key: service-ca.crt |
| 66 | + configMapName: openshift-service-ca.crt |
| 67 | + type: lokiStack |
| 68 | +# ... |
| 69 | + pipelines: # <6> |
| 70 | + - name: syslog-pipeline |
| 71 | + inputRefs: |
| 72 | + - syslog-receiver |
| 73 | + outputRefs: |
| 74 | + - <output_name> |
| 75 | +# ... |
| 76 | +---- |
| 77 | +<1> Use the service account that you granted the `collect-infrastructure-logs` permission in the previous step. |
| 78 | +<2> Specify a name for your input receiver. |
| 79 | +<3> Specify the input receiver type as `syslog`. |
| 80 | +<4> Optional: Specify the port that the input receiver listens on. This must be a value between `1024` and `65535`. |
| 81 | +<5> If TLS configuration is not set, the default certificates will be used. For more information, run the command `oc explain clusterlogforwarders.spec.inputs.receiver.tls`. |
| 82 | +<6> Configure a pipeline for your input receiver. |
| 83 | + |
| 84 | +. Apply the changes to the `ClusterLogForwarder` CR by running the following command: |
| 85 | ++ |
| 86 | +[source,terminal] |
| 87 | +---- |
| 88 | +$ oc apply -f <filename>.yaml |
| 89 | +---- |
| 90 | + |
| 91 | +. Verify that the collector is listening on the service that has a name in the `<clusterlogforwarder_resource_name>-<input_name>` format by running the following command: |
| 92 | ++ |
| 93 | +[source,terminal] |
| 94 | +---- |
| 95 | +$ oc get svc |
| 96 | +---- |
| 97 | ++ |
| 98 | +.Example output |
| 99 | ++ |
| 100 | +[source,terminal,options="nowrap"] |
| 101 | +---- |
| 102 | +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE |
| 103 | +collector ClusterIP 172.30.85.239 <none> 24231/TCP 33m |
| 104 | +collector-syslog-receiver ClusterIP 172.30.216.142 <none> 10514/TCP 2m20s |
| 105 | +---- |
| 106 | ++ |
| 107 | +In this example output, the service name is `collector-syslog-receiver`. |
| 108 | + |
| 109 | +.Verification |
| 110 | + |
| 111 | +. Extract the certificate authority (CA) certificate file by running the following command: |
| 112 | ++ |
| 113 | +[source,terminal] |
| 114 | +---- |
| 115 | +$ oc extract cm/openshift-service-ca.crt -n <namespace> |
| 116 | +---- |
| 117 | ++ |
| 118 | +[NOTE] |
| 119 | +==== |
| 120 | +If the CA in the cluster where the collectors are running changes, you must extract the CA certificate file again. |
| 121 | +==== |
| 122 | + |
| 123 | +. As an example, use the `curl` command to send logs by running the following command: |
| 124 | ++ |
| 125 | +[source,terminal] |
| 126 | +---- |
| 127 | +$ curl --cacert <openshift_service_ca.crt> collector-syslog-receiver.<namespace>.svc:10514 “test message” |
| 128 | +---- |
| 129 | ++ |
| 130 | +Replace <openshift_service_ca.crt> with the extracted CA certificate file. |
| 131 | + |
| 132 | +//// |
| 133 | +. As an example, send logs by running the following command: |
| 134 | ++ |
| 135 | +[source,terminal] |
| 136 | +---- |
| 137 | +$ logger --tcp --server collector-syslog-receiver.<ns>.svc:10514 “test message” |
| 138 | +---- |
| 139 | +//// |
0 commit comments