Guardium Insights 日志记录
对于 Guardium® Insights ,日志记录部署在 Red Hat® OpenShift® Container Platform Version 4.10.x 环境中。 集群日志记录组件基于 Elasticsearch, Fluentd和 Kibana (EFK)。
OpenShift 日志记录组件
收集器 Fluentd部署到 OpenShift Container Platform 集群中的每个节点。 它收集所有节点和容器日志,并将它们写入 Elasticsearch。 Kibana 是集中式 Web 用户界面,用户和管理员可以在其中使用聚集的数据创建丰富的可视化和仪表板。
当前有五种不同类型的集群日志记录组件:
- logStore 是存储日志的位置。 当前实现基于Elasticsearch。
- 集合是从节点收集日志,对其进行格式化并将其存储在 logStore中的组件。 当前实现基于 Elasticsearch Fluentd。
- 可视化是用于查看日志,图形和图表等的用户界面组件。 当前实现基于 Kibana。
- Curation 是按年龄过滤日志的组件。 当前实现基于 Elasticsearch Curator。
- 事件路由是将 OpenShift Container Platform 事件转发到集群日志记录的组件。 当前实现基于 OpenShift Event Router。
更多信息,请参阅 OpenShift 日志。
Pod 分发
对于 Guardium Insights,将日志记录部署到具有以下资源的 OpenShift Container Platform V 4.10.x 和 4.12.x 环境:
3 master nodes with 32GB RAM and 8 Core Processor each
3 worker nodes with 32GB RAM and 8 Core Processor each
下表概述了每个组件的 CPU 和内存资源。
| 舱 | 节点 | CPU 限制 | 内存 限制 | CPU 请求 | 内存请求 | 副本 |
|---|---|---|---|---|---|---|
| cluster-logging-operator | 工作者 | 不适用 | 不适用 | 100 m | 1Gi | 1 |
| Curator | 主站点 | 200 m | 200Mi | 200 m | 200Mi | 1 |
| elasticsearch-cdm | 主站点 | 4000 m | 8Gi | 4000 m | 8Gi | 2 |
| fluentd | 主和工作程序 | 200 m | 1Gi | 200 m | 1Gi | 所有节点 |
| kibana | 主站点 | 不适用 | 1Gi | 500 m | 1Gi | 1 |
要在启用了日志记录的 OpenShift Container Platform V 4.10.x 和 4.12.x 集群上查看每个组件的 CPU 和内存资源,请运行以下命令: oc get pods -n openshift-logging
在集群中安装日志记录组件
要在集群中安装日志记录组件,请按照 OpenShift Container Platform 版本 4.10.x 和 4.12.x 日志记录文档( https://access.redhat.com/documentation/en-us/openshift_container_platform/4.7/html/logging/cluster-logging-deploying#cluster-logging-deploy-clo_cluster-logging-deploying )。
Guardium Insights 日志记录部署中需要以下配置。
当遵循上述 OpenShift Container Platform 版本 4.10.x 和 4.12.x 文档(第 3.2 节,第4步( https://access.redhat.com/documentation/en-us/openshift_container_platform/4.7/html/logging/cluster-logging-deploying#cluster-logging-deploy-clo_cluster-logging-deploying )),通过复制以下YAML文件创建集群日志记录实例,部署
ClusterLogging实例。 此修改的定制资源定义 (CRD) 确保日志记录组件部署在主节点上,并使用指定的已调整资源。apiVersion: "logging.openshift.io/v1" kind: "ClusterLogging" metadata: name: "instance" namespace: "openshift-logging" spec: managementState: "Managed" logStore: type: "elasticsearch" elasticsearch: nodeCount: 2 resources: limits: memory: 8Gi requests: cpu: 4000m memory: 8Gi storage: size: "30G" redundancyPolicy: "SingleRedundancy" tolerations: - effect: NoSchedule key: node-role.kubernetes.io/master operator: Exists visualization: type: "kibana" kibana: resources: limits: memory: 1Gi requests: cpu: 500m memory: 1Gi replicas: 1 tolerations: - effect: NoSchedule key: node-role.kubernetes.io/master operator: Exists curation: type: "curator" curator: resources: limits: memory: 200Mi requests: cpu: 200m memory: 200Mi schedule: "15 * * * *" tolerations: - effect: NoSchedule key: node-role.kubernetes.io/master operator: Exists collection: logs: type: "fluentd" fluentd: resources: limits: memory: 1Gi requests: cpu: 200m memory: 1Gi- 要创建集群日志记录定制资源和 Elasticsearch 定制资源,请单击创建。
- 要验证安装,请运行以下命令:
oc get pods -n openshift-logging期望的结果使所有日志记录 pod 都处于正在运行状态。 在验证结果时,编辑 Curator 配置以在 7 天后删除日志,代替缺省 30 天。
- 要切换到
openshift-logging名称空间,请运行以下命令:oc project openshift-logging - 要编辑 curator 配置,请运行以下命令:
oc edit configmap/curator找到此部分:
# uncomment and use this to override the defaults from env vars #.defaults: # delete: # days: 30例如,要允许在 7 天后删除日志,请编辑如下所示的部分:
# uncomment and use this to override the defaults from env vars .defaults: delete: days: 7 保存
configmap/curator。
如何访问集群中的 Kibana
您可以从命令行界面 (CLI) 获取 Kibana 的 URL。
- 运行此命令以查找到 Kibana 的路由。
命令返回一个 URL ,如下所示:oc get routes -n openshift-logginghttp://kibana-openshift-logging.hostname.com:port - 要访问Kibana,请将 URL 复制到浏览器中,并使用您的 OpenShift 用户界面凭据登录。
还可以从 Monitoring 部分中的 OpenShift Console 启动日志记录。