【问题标题】:Logstash grok pattern to catch the first line with the string ExceptionLogstash grok 模式用字符串 Exception 捕获第一行
【发布时间】:2022-01-07 16:27:16
【问题描述】:

这是一个示例日志:

2022-01-07 11:05:01,185 [http-nio-8080-exec-526] WARN  de.web.Main| = - Error while execute Request
javax.servlet.ServletException: com.cg.blart.web.HttpInvocationException: Invalid tenant session
    at com.cg.blume.web.DispatchingServlet.doGet(DispatchingServlet.java:169)
    at de.jinx.lee.web.AutoDBUpgradeDispatchingServlet.lambda$doGet$0(AutoDBUpgradeDispatchingServlet.java:200)
    at de.jinx.lee.web.AutoDBUpgradeDispatchingServlet.addMDCKey(AutoDBUpgradeDispatchingServlet.java:297)
Caused by: com.cg.blume.web.HttpInvocationException: Invalid tenant session
    at com.cg.blume.web.procedure.HttpSessionManager.get(HttpSessionManager.java:190)
    at de.jinx.lee.web.session.leeHttpSessionManager.get(leeHttpSessionManager.java:76)
    ... 41 more

这是目前的模式: ^.*?Exception: +%{DATA:exception}$

我得到的输出很接近,但没有雪茄:"com.cg.blart.web.HttpInvocationException: Invalid tenant session"。对于我的生活,我无法让它与整条线相匹配。你能给我指路吗?所需的输出是: javax.servlet.ServletException: com.cg.blart.web.HttpInvocationException: Invalid tenant session

这是一个测试工具的链接:https://grokdebug.herokuapp.com/

【问题讨论】:

    标签: regex logstash-grok grok


    【解决方案1】:

    解决方案是这种模式:

    (?<DATA:mps_exception>.*?(Exception:).*)
    

    这里解释:https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html#_custom_patterns

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多