就在几周前,我们将 filebeat、metricbeat 和 apm 添加到了在我们的 kubernetes 集群上运行的 dotnet 核心应用程序中。它工作得很好,最近我们发现 filebeat 和 metricbeat 能够根据几个规则编写不同的索引。
我们想对 APM 做同样的事情,但是搜索文档我们找不到任何选项来设置要写入的索引的名称。
这甚至可能吗,如果是的话,它是如何配置的?
我还尝试在代码库中查找当前名称apm-*
,但在配置时找不到任何匹配项。
我们要解决的问题是 kibana 中的每个空间都可以看到每个应用程序的 apm 指标。某些应用程序不应该在这个空间内,所以我认为一个新的apm-application-*
索引可以解决问题......
编辑
因为它不应该在代理上配置,而是在云服务控制台中配置。我无法根据自己的喜好“覆盖”设置。
我想要的规则:
- 当应用程序不在kubernetes 命名空间内
default
或kube-system
写入名为的索引时apm-7.8.0-application-type-2020-07
- 其他命名空间中的所有其他应用程序应保留在默认索引中
我看到你可以添加output.elasticsearch.indices
来实现这一点:Array of index selector rules supporting conditionals and formatted string.
我通过复制与 metricbeat 相同的内容进行了尝试,并将其更新为使用 apm 语法,并得出以下“用户覆盖”
output.elasticsearch.indices:
- index: 'apm-%{[observer.version]}-%{[kubernetes.labels.app]}-%{[processor.event]}-%{+yyyy.MM}'
when:
not:
or:
- equals:
kubernetes.namespace: default
- equals:
kubernetes.namespace: kube-system
但是当我使用这个设置时它告诉我:
Your changes cannot be applied
'output.elasticsearch.indices.when': is not allowed
Set output.elasticsearch.indices.0.index to apm-%{[observer.version]}-%{[kubernetes.labels.app]}-%{[processor.event]}-%{+yyyy.MM}
Set output.elasticsearch.indices.0.when.not.or.0.equals.kubernetes.namespace to default
Set output.elasticsearch.indices.0.when.not.or.1.equals.kubernetes.namespace to kube-system
然后我更新了示例,但得出了相同的结论,因为它也无效..