SplunkForwarder用于提供Apache对Splunk的访问日志(或由DevOps告知)。 AFAIK无法根据给定的regEx(我要解决的 ISSUE )过滤掉日志。正在考虑在Apache上添加一个触发器,如果该请求的URL模式在白名单中,它将拦截所有请求并向Splunk发送消息(发现Splunk HTTP事件收集器-以前从未使用过-闻起来像是解决方案的一部分) 。 试图找到有关如何使用mod_actions模块的正确示例。不幸的是,没有找到对我有用的东西。 Apache的文档没有用。不知道mod_actions是否是我唯一的选择。 请问我如何为每个请求执行py / sh / pl或其他脚本? DevOps可能不允许我向Apache添加任何奇特的(非标准)模块。 非常感谢。
答案 0 :(得分:2)
完全有可能基于正则表达式过滤日志。您将需要一个索引器上的应用程序,以根据通用转发器上的 inputs.conf 中定义的源类型进行过滤。
下面提供的props.conf / transforms.conf组合仅保留包含字符串 Error 或 Warning 的日志行,而所有其他消息将发送到nullqueue(已删除)
$ SPLUNK_HOME $ / etc / apps / your_app / local / props.conf $ SPLUNK_HOME $ / etc / apps / your_app / local / transforms.conf
props.conf
[your_sourcetype]
TRANSFORMS-set = setnull, setparsing
transforms.conf
# This sends all events to be ignored
[setnull]
REGEX = .
DEST_KEY = queue
FORMAT = nullQueue
# this says ignore all events, except the ones containing ERROR
[setparsing]
REGEX = Error|Warning
DEST_KEY = queue
FORMAT = indexQueue
[your_sourcetype1]
TRANSFORMS-set = setnull, setparsing
[your_souretype2]
TRANSFORMS-set = setnull, setparsing