Datadog Regex解析器规则未应用于日志

发布于 2025-02-13 15:40:01 字数 311 浏览 0 评论 0原文

我已经在Grok Parser中写了一条正则规则,以解析日志URL路径。虽然它说这些模式在示例部分中匹配,但是在检查实时尾巴时,我看不到规则得到正确应用。请为此提供帮助。

使用的正则是:parseurl%{regex(“^([\/] [\ w \ d \ - \/] ([az] [\ w \ d \ \ - ] [^\ w \ d \ \ - \。 ]))| [\/]”):http.url_details.patternx}。

示例日志模式:输入: /abcd /efgh?13224预期: /abcd /efgh

ps:iam新手

I have written a regex rule in Grok parser to parse the log url paths. While it says the patterns matches in the sample section, but when checking the live tail i couldn't see the rules getting applied correctly. Please can you help on this.

regex used: parseurl %{regex("^([\/][\w\d\-\/]([a-z][\w\d\-][^\w\d\-\.]))|[\/]"):http.url_details.patternx}.

Sample log patterns: Input: /abcd/efgh?13224 Expected: /abcd/efgh

PS: Iam new to Datadog

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

少钕鈤記 2025-02-20 15:40:01

您的示例是JavaScript Regex。有很多正则。 Grok Regex具有特定的语法;它与任意的正则发动机无法使用。

您需要使用Grok语法而不是JS或PCRE等。此工具可以帮助您构建和测试表达式。 https://grokconstructor.appspot.com/

Your example is JavaScript regex. There are many kinds of regex. Grok regex has a specific syntax; it won't work with arbitrary regex engines.

You need to use Grok syntax rather than JS or PCRE etc. This tool can help you build and test your expressions. https://grokconstructor.appspot.com/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文