This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.第 6 章 Forwarding logs to third party systems
By default, OpenShift Container Platform cluster logging sends logs to the default internal Elasticsearch log store, defined in the ClusterLogging
custom resource (CR).
You can configure cluster logging to send logs to destinations outside of your OpenShift Container Platform cluster instead of the default Elasticsearch log store using the following methods:
- Sending logs using the Fluentd forward protocol. You can create a config map to use the Fluentd forward protocol to securely send logs to an external logging aggregator that accepts the Fluent forward protocol.
- Sending logs using syslog. You can create a config map to use the syslog protocol to send logs to an external syslog (RFC 3164) server.
Alternatively, you can use the Log Forwarding API, currently in Technology Preview. The Log Forwarding API, which is easier to configure than the Fluentd protocol and syslog, exposes configuration for sending logs to the internal Elasticsearch log store and to external Fluentd log aggregation solutions.
You cannot use the config map methods and the Log Forwarding API in the same cluster.
The Log Forwarding API is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see https://access.redhat.com/support/offerings/techpreview/.
The methods for forwarding logs using a config map are deprecated and will be replaced by the Log Forwarding API in a future release.
6.1. Forwarding logs using the Fluentd forward protocol 复制链接链接已复制到粘贴板!
You can use the Fluentd forward protocol to send a copy of your logs to an external log aggregator, instead of the default Elasticsearch log store. On the OpenShift Container Platform cluster, you use the Fluentd forward protocol to send logs to a server configured to accept the protocol. You are responsible to configure the external log aggregator to receive the logs from OpenShift Container Platform.
This method for forwarding logs is deprecated in OpenShift Container Platform and will be replaced by the Log Forwarding API in a future release.
To configure OpenShift Container Platform to send logs using the Fluentd forward protocol, create a ConfigMap called secure-forward
in the openshift-logging
namespace that points to an external log aggregator.
Starting with the OpenShift Container Platform 4.3, the process for using the Fluentd forward protocol has changed. You now need to create a ConfigMap, as described below.
Additionally, you can add any certificates required by your configuration to a secret named secure-forward
that will be mounted to the Fluentd Pods.
Sample secure-forward.conf
Sample secure-forward
ConfigMap based on the configuration
Procedure
To configure OpenShift Container Platform to forward logs using the Fluentd forward protocol:
Create a configuration file named
secure-forward.conf
for the forward parameters:Configure the secrets and TLS information:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify the default value of the auto-generated certificate common name (CN).
- 2
- Enter the Shared key between nodes
- 3
- Specify
tls
to enable TLS validation. - 4
- Set to
true
to verify the server cert hostname. Set tofalse
to ignore server cert hostname. - 5
- Specify the path to private CA certificate file as
/etc/ocp-forward/ca_cert.pem
.
To use mTLS, see the Fluentd documentation for information about client certificate, key parameters, and other settings.
Configure the name, host, and port for your external Fluentd server:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a ConfigMap named
secure-forward
in theopenshift-logging
namespace from the configuration file:oc create configmap secure-forward --from-file=secure-forward.conf -n openshift-logging
$ oc create configmap secure-forward --from-file=secure-forward.conf -n openshift-logging
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Import any secrets required for the receiver:
oc create secret generic secure-forward --from-file=<arbitrary-name-of-key1>=cert_file_from_fluentd_receiver --from-literal=shared_key=value_from_fluentd_receiver
$ oc create secret generic secure-forward --from-file=<arbitrary-name-of-key1>=cert_file_from_fluentd_receiver --from-literal=shared_key=value_from_fluentd_receiver
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
oc create secret generic secure-forward --from-file=ca-bundle.crt=ca-for-fluentd-receiver/ca.crt --from-literal=shared_key=fluentd-receiver
$ oc create secret generic secure-forward --from-file=ca-bundle.crt=ca-for-fluentd-receiver/ca.crt --from-literal=shared_key=fluentd-receiver
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Refresh the
fluentd
Pods to apply thesecure-forward
secret andsecure-forward
ConfigMap:oc delete pod --selector logging-infra=fluentd
$ oc delete pod --selector logging-infra=fluentd
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Configure the external log aggregator to accept messages securely from OpenShift Container Platform.