Regex 用于提取复杂线条结构的Grok模式?

Regex 用于提取复杂线条结构的Grok模式?,regex,logstash-grok,grok,Regex,Logstash Grok,Grok,我有一行像 sgcib.solstis.core.dao.referential.InsertionMonitoringDao:10:37:36.860[SOLSTAIRJVM1:customService:false-persistor-3-]信息开始更新插入监视表:analysisProcessId=10000064897,insertionMonitorId=9153700,binFileName=TIS_MRM_Meteor_DeltaSpot_RA_SMCPLX_47769.2x2.2

我有一行像

sgcib.solstis.core.dao.referential.InsertionMonitoringDao:10:37:36.860[SOLSTAIRJVM1:customService:false-persistor-3-]信息开始更新插入监视表:analysisProcessId=10000064897,insertionMonitorId=9153700,binFileName=TIS_MRM_Meteor_DeltaSpot_RA_SMCPLX_47769.2x2.2016-11-29-00-00_1480377600000.bin.tisdevweb043.SOLSTAIRJVM1

这里,将值[SOLSTAIRJVM1:customService:false-persistor-3-]提取为线程字段100000648897作为一个analysisProcessId字段9153700作为另一个insertionMonitorId字段。输入行中的字段值是可选的,如果在输入行中找不到字段,则必须以空值显示

有谁能建议如何写这个图案吗?

你可以用

\[(?<thread>[^\]\[]*)].*?analysisProcessId=(?<analysisProcessId>\d+).*?insertionMonitorId=(?<insertionMonitorId>\d+)

\[(?[^\]\[]*)].*?analysisProcessId=(?

可能
\[(?[^\]\[]*)].*?analysisProcessId=(?\d+).*?insertionMonitorId=(?\d+)
?谢谢让我在url中测试。不,没有幸运请使用上面的url。我正在尝试上面的正则表达式在发布之前在链接中进行了测试。因此在评论中添加了垃圾字符。请参阅,从regex101小提琴复制模式。非常感谢。我已经得到了解决方案,您可以建议同时提取字段。如何使用original精确的行作为另一个字段?你的意思是整个字符串本身应该是一个字段吗?类似于。非常感谢您为给定的输入“anystring[anystring1]IN”,如果模式是。*?(?[*),这里的thread_name字段值是anystring1。如果[anystring1]不存在,那么thread_name的值为“”。新模式将是什么?嗨,你回来了,谢谢没有使用(?:[.*)?)将[anystring1]提取为字段值。很抱歉,我使用了(?[.])not.*(?[.*))