如何使用Splunk中的多个划界值提取数据

发布于 2025-01-24 07:12:31 字数 826 浏览 0 评论 0原文

我的日志中有以下字符串,带有多个分隔线(:= and#)。 的所有值

 tenant |countryCode |deviceType |platformID|paymentMethod1|paymentMethod2|userAgent
 XYZ    | US         | IOS        |13        |p1            |p2            |Mozilla /20.0.553 Mozilla/5.0      

的logs字符串

TrackingLogs tenant=XYZ, countryCode=US, deviceType:IOS, platformID:13,currency=USD, paymentMethods:P1 # P1 # P2 # P2 # P4 # , userAgent:Mozilla /20.0.553 Mozilla/5.0

我期望我尝试过用于':'

search string| rex field=_raw "deviceType\:\s+?(?<deviceType>\S+)" |table  deviceType

,但没有结果=我使用以下查询,但不知道如何将其结合在一起:and#

search trackinglog  | rex field=tenant "(?<tenant>[^\.]*)\.[a-zA-Z]"| table _raw tenant, countryCode , currency , paymentMethods

I have the below string in logs with multiple delimiters (: = and #). I am expecting all the values in tabular formate like

 tenant |countryCode |deviceType |platformID|paymentMethod1|paymentMethod2|userAgent
 XYZ    | US         | IOS        |13        |p1            |p2            |Mozilla /20.0.553 Mozilla/5.0      

logs string

TrackingLogs tenant=XYZ, countryCode=US, deviceType:IOS, platformID:13,currency=USD, paymentMethods:P1 # P1 # P2 # P2 # P4 # , userAgent:Mozilla /20.0.553 Mozilla/5.0

I tried for ':' but no result

search string| rex field=_raw "deviceType\:\s+?(?<deviceType>\S+)" |table  deviceType

for = I used below query it worked but don't know how to combine it with : and #

search trackinglog  | rex field=tenant "(?<tenant>[^\.]*)\.[a-zA-Z]"| table _raw tenant, countryCode , currency , paymentMethods

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

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

发布评论

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

评论(1

回忆追雨的时光 2025-01-31 07:12:31

第一个查询的问题不是分隔符,而是正则态度本身。它预计没有一个没有存在的空间。此变化有效:

| rex field=_raw "deviceType:\s*?(?<deviceType>\S+)" |table  deviceType

为了更好的结果,请尝试frestion命令。

| extract pairdelim="," kvdelim=":="

The problem with the first query is not the separator, but the regex itself. It expects a space where none exists. This variation works:

| rex field=_raw "deviceType:\s*?(?<deviceType>\S+)" |table  deviceType

For better results, however, try the extract command.

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