Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex Java日志的正则表达式模式_Regex_Logging_Fluentd - Fatal编程技术网

Regex Java日志的正则表达式模式

Regex Java日志的正则表达式模式,regex,logging,fluentd,Regex,Logging,Fluentd,我正在尝试使用fluentd中的正则表达式解析器插件来索引我的应用程序的日志 这里有一个片段 2020-05-06T22:34:50.860-0700-警告[main]o.s.b.GenericTypeAwarePropertyDescriptor:正在访问无效的JavaBean属性“管道”!在实际使用的[public void com.theoal.module.pipeline.mbean.dynamicphaseExecutionConfiguration MBeanBuilder.set

我正在尝试使用fluentd中的正则表达式解析器插件来索引我的应用程序的日志

这里有一个片段

2020-05-06T22:34:50.860-0700-警告[main]o.s.b.GenericTypeAwarePropertyDescriptor:正在访问无效的JavaBean属性“管道”!在实际使用的[public void com.theoal.module.pipeline.mbean.dynamicphaseExecutionConfiguration MBeanBuilder.setPipeline(com.theplatform.module.pipeline.dynamicPeline)]旁边发现了不明确的写入方法:[public void com.theplatform.module.pipeline.mbean.phaseExecutionConfiguration MBeanBuilder.setPipeline(com.theoal.module.pipeline.pipeline)]

我使用了regex101.com来匹配regex模式,但我无法获得匹配

d{4}-\d{2}-\d{2}(?[A-Z][A-Z]{1}\d{2}:\d{2}.\d{3}-\d{4})s\-\s(?[\w\]{6})\s+(?\[[A-Z][A-Z]+])\s(?.*$

请帮忙。 谢谢

您可以使用

^(?<date>\d{4}-\d{2}-\d{2})[A-Z](?<timestamp>\d{2}:\d{2}:\d{2}\.\d{3}-\d{4})\s+-\s+(?<loglevel>\w+)\s+(?<class>\[\w+\])\s+(?<message>.*)
:


我在parsers.conf文件中添加了相同的内容,但没有得到预期的输出。当我试图在Splunk仪表板上显示它时,整个线路被视为一个事件
<source>
  type tail
  path /var/log/foo/bar.log
  pos_file /var/log/td-agent/foo-bar.log.pos
  tag foo.bar
  format /^(?<date>\d{4}-\d{2}-\d{2})[A-Z](?<timestamp>\d{2}:\d{2}:\d{2}\.\d{3}-\d{4})\s+-\s+(?<loglevel>\w+)\s+(?<class>\[\w+\])\s+(?<message>.*)/
</source>