附录 C. redaction 配置 YAML 文件的选项


注意

从 RHEL RHEL 6.10, 7.9, 8.3 和更高的版本开始,Insights 客户端使用 YAML 文件来配置 redaction。在早期版本中,remove.conf 文件控制掩盖操作。

C.1. redaction 配置 YAML 文件的选项

注意

从 RHEL RHEL 6.10, 7.9, 8.3 和更高的版本开始,Insights 客户端使用 YAML 文件来配置 redaction。在早期版本中,remove.conf 文件控制掩盖操作。

表 C.1. file-redaction.yaml的文件 redaction 示例
内容描述
# file-redaction.yaml
---

包含文件名的可选注释。

# Exclude the entire output of commands
#   Specify the full command path or the symbolic name in .cache.json

 commands:
- /bin/rpm -qa
- /bin/ls
- ethtool_i

/bin/rpm -qabin/ls 的整个输出不包括在归档文件中。

.cache.json 文件中,完整命令 /sbin/ethtool -i 映射到符号链接名称 ethtool_i

# Exclude the entire output of files
#  Specify the full filename path or the symbolic name in .cache.json

files:
- /etc/audit/auditd.conf
- cluster_conf

对于指定的文件,文件名和文件内容不包括在归档文件中。

.cache.json 文件中,完整文件路径 /etc/cluster/cluster.conf 映射到符号链接 cluster_conf。

表 C.2. file-content-redaction.yaml的内容 redaction 示例
内容描述
# file-content-redaction.yaml
---

包含文件名的可选注释。

# Pattern redaction per matching line
#  Lines that match a pattern are excluded from files and command output.
#  Patterns are processed in the order that they are listed.
# Example

patterns:
 - "a_string_1"
 - "a_string_2"

当模式与包含 a_string_1a_string_2 的任何行匹配,它们会被从文件和命令输出中排除。将模式字符串放在引号中。

#
# Regular expression pattern redaction per line
#  Patterns with regular expressions (regex) are wrapped with "regex:"
# Example

patterns:
 regex:
 - "abc.*def"
 - "localhost[[:digit:]]"
 #

正则表达式被打包为 正则表达式。您可以使用 egrep 命令识别的任何正则表达式(regex)。将正则表达式放在引号内。

# Lines matching these regular expressions are excluded
# from output.
patterns:
  regex:
  - "*\.conf"
  - "^include"

egrep 表达式用引号括起,以确保正确识别正则表达式字符。

在本例中,如果任何字符串包含 .conf,或者任何行以 include 开头,则从存档文件中删除行。

# Replace keywords in files and command output with generic identifiers by the Python soscleaner module
keywords:
- "1.1.1.1"
- "My Name"
- "a_name"

keywords: 数组中的字符串被实际 value 关键字 和数字替换。

例如,字符串 1.1.1.1 的每个实例都替换为 keyword0。字符串 My Name 的所有实例都被替换为 keyword1a_name 替换为 keyword3,您定义的每个附加关键字都会替换为增量 关键字n。替换 关键字n 的值由 Python SoS 进程决定且无法更改。

您在 keywords: 数组中定义的字符串区分大小写。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.