Splunk 有transaction
可以duration
在按 id 分组的日志之间生成的命令:
2020-01-01 12:12 event=START id=1
2020-01-01 12:13 event=STOP id=1
Run Code Online (Sandbox Code Playgroud)
正如它所描述的
如何计算Datadog中事件之间的持续时间?
我运行查询并以表的形式获取 custId 列表。我如何将此结果传递到 IN 子句内的另一个搜索查询中。
例如:
搜索 1: index=* "成功登录"|表 custID 这为我提供了带有列 custID 的表。
然后我必须跑
index=* "邮件发送者"|where custID IN (搜索 1) |table CustID,_time
在Splunk搜索查询中如何检查日志消息是否有文本?
日志消息:
message: 2018-09-21T07:15:28,458+0000 comp=hub-lora-ingestor-0 [vert.x-eventloop-thread-0] INFO com.nsc.iot.hono.receiver.HonoReceiver - Connected successfully, creating telemetry consumer ...
Run Code Online (Sandbox Code Playgroud)
我想检查消息是否包含“连接成功,创建遥测消费者...”并基于此想要将 1 或 0 分配给变量
Splunk 搜索查询
(index="05c48b55-c9aa-4743-aa4b-c0ec618691dd" ("Retry connecting in 1000ms ..." OR "Connect or create consumer failed with exception" OR "Connected successfully, creating telemetry consumer ..."))
| rex field=_raw ^(?:[^ \n]* ){7}(?P<success_status_message>\w+\s+\w+,\s+\w+\s+\w+\s+\w+)"
| timechart count as status | eval status=if(isnull(success_status_message), 0, 1)
Run Code Online (Sandbox Code Playgroud)
success_status_message 始终为 null
要查找包含“gen-application”的日志行,我使用以下搜索查询:
source="general-access.log" "*gen-application*"
Run Code Online (Sandbox Code Playgroud)
如何修改查询以便返回不包含“gen-application”的行?
source="general-access.log" != " gen-application " 返回错误:
Error in 'search' command: Unable to parse the search: Comparator '!=' has an invalid term on the left hand side:
Run Code Online (Sandbox Code Playgroud) 如何从搜索返回的 splunk 事件列表中获取特定 splunk 事件的 url?
如果这是不可能的,并且我需要创建一个只返回该事件的搜索,那么我可以在查询中使用的每个事件是否有一些唯一的 ID?
我对 Splunk 非常陌生,基本上已经陷入了困境!对语言也很陌生,所以下面的任何帮助和提示都会很棒。
我想要得到的结果是加入查询并获取用户名、ID 和登录次数。
查询来自 diff 源、源类型和主机。
查询 1 是用户名和 ID,查询 2 是用户名和登录次数。
查询1:userName=” ”entityNumber=” ” | eval 用户名=upper(用户名) | 重复数据删除用户名、实体编号 | 将用户名重命名为 User | 表用户,实体编号
查询2:“登录成功。” | rex field=_raw "用户[\":] (?[^\"IP] )"| 评估用户=上层(用户)| 表用户 | 按用户统计计数
在此先感谢您的帮助。J
splunk splunk-query splunk-calculation splunk-formula splunk-sdk
我的用例是提供每天特定错误(按特定模式搜索)的计数,并提供此类“错误”请求相对于每天处理的请求总数(不使用错误模式搜索)的百分比。无法为其形成适当的查询。基本查询是 -
获取每天的总计数:
index=my_index | bucket _time span=day | stats count by _time
Run Code Online (Sandbox Code Playgroud)
只获取每天的错误:
index=my_index "Error-Search-Pattern" | bucket _time span=day | stats count by _time
Run Code Online (Sandbox Code Playgroud)
如何合并两个计数以并排显示并显示错误:总百分比?
提前致谢。
在 Splunk 中,我尝试提取 JSON 结构的“标签”元素内的键值对,以便每个键值对成为一个单独的列,以便我可以搜索它们。例如 :
| spath data | rename data.tags.EmailAddress AS Email
Run Code Online (Sandbox Code Playgroud)
但这并没有帮助,电子邮件字段为空。我正在尝试对所有标签执行此操作。有什么想法/指示吗?
{
"timestamp": "2021-10-26T18:23:05.180707Z",
"data": {
"tags": [
{
"key": "Email",
"value": "john.doe@example.com"
},
{
"key": "ProjectCode",
"value": "ABCD"
},
{
"key": "Owner",
"value": "John Doe"
}
]
},
"field1": "random1",
"field2": "random2"
}
Run Code Online (Sandbox Code Playgroud) 有谁知道如何准确计算Splunk中的99.9%?
我尝试了如下各种方法,例如exactperc(但这只需要整数百分位数)和perc(但这非常接近结果)。
base | stats exactperc99(latency) as "99th Percentile", p99.9(latency) as "99.9th Percentile"
Run Code Online (Sandbox Code Playgroud)
谢谢,詹姆斯
2018-06-20T00:04:35.000+00:00 (980) WAL Autocheckpointing, name=C:\Program
Files\PriceService\data\documents.db
2018-06-20T00:07:16.000+00:00 (980) WAL Autocheckpointing, name=C:\Program
Files\PriceService\data\store-promotions.db
2018-06-20T00:07:21.000+00:00 (980) WAL Autocheckpointing, name=C:\Program
Files\PriceService\data\store-promotions.db
2018-06-20T00:07:26.000+00:00 (980) WAL Autocheckpointing, name=C:\Program
Files\PriceService\data\store-promotions.db
Run Code Online (Sandbox Code Playgroud)
我一直在尝试正确执行 splunk 查询,以便将这一事件拆分为多个事件,但由于某种原因,我无法正确执行查询。
我尝试在换行符上拆分,但结果集返回不变。我从网上阅读了解到我应该使用以下内容
myQuery | rex field=_raw "\[(?P<field1>...).*[\r\n]"
Run Code Online (Sandbox Code Playgroud)
顺便说声抱歉。我的正则表达式游戏不强。
我目前有一个查询聚合过去一小时内的事件,并在事件超过特定阈值时提醒我的团队。该查询最近被意外禁用,结果有时警报应该触发但没有触发。
我的目标是将这个警报查询逻辑应用到上个月,并确定警报会触发多少次,如果它起作用的话。但是,我很难弄清楚如何最好地对这些进行分组。在伪代码中,我基本上我会(运行超过 30 天的时间范围):
index="some_index" | where count > n | group by hour
Run Code Online (Sandbox Code Playgroud)
希望这是有道理的,如果不是,我很高兴提供一些说明。
提前致谢
我有一个非常简单的timechart
查询:
index="myIndex" "searchText"
| timechart span=1d
Run Code Online (Sandbox Code Playgroud)
Splunk 日志采用 UTC 格式,但我需要图表来显示当地时间的数据。
我已将以下包含 JSON 行的示例文件加载到 Splunk 中:
{"duration":2134,"input":["foo","bar"],"level":"info","msg":"Processed input","time":"2022-04-07T08:10:23.14427-07:00"}
{"duration":997,"input":["baz"],"level":"info","msg":"Processed input","time":"2022-04-07T08:10:23.144526-07:00"}
Run Code Online (Sandbox Code Playgroud)
Splunk has parsed these fields such that the input
field is a list:
I would like to generate a table of the length of (number of elements in) the input and the
duration
field. Following https://docs.splunk.com/Documentation/StreamProcessor/standard/FunctionReference/List#length.28input.29, I've tried
msg="Processed input"
| eval N=length(input)
| table N, duration
Run Code Online (Sandbox Code Playgroud)
but this yields no values for N
:
What would be the correct way to determine N
?
splunk-query ×13
splunk ×12
logging ×2
datadog ×1
devops ×1
java ×1
monitoring ×1
percentile ×1
regex ×1
splunk-sdk ×1