Splunk 查询示例
rangmap使用
index= aliyun sourcetype=ali_formatted_cdn (message.reqPath="/merch/products/v2*" OR message.reqPath="/merch/skus/v2*" OR message.reqPath="/merch/value_added_services/v1*" OR message.reqPath="/merch/contents/v1*" OR message.reqPath="/merch/prices/v2*" ) NOT message.reqPath="*batch*"
| replace /merch/products/v2* with merchproductsv2 in message.reqPath
| replace /merch/skus/v2* with merchskusv2 in message.reqPath
| replace /merch/value_added_services/v1* with vasv1 in message.reqPath
| replace /merch/contents/v1* with productcontentservice in message.reqPath
| replace /merch/prices/v2* with merchpricesv2 in message.reqPath
| stats count BY netPerf.downloadTime
| rangemap field=netPerf.downloadTime 0-2s=0-2000 2-5s=2001-5000 5-10s=5001-10000 10-30s=10001-30000 30-60s=30001-60000 default=60s+
| stats sum(count) by range
嵌套查询:
index=app app=xx [search index=app app=xx traceId=xx | top limit=10| table traceId]
正则表达:
index=app app=servicemonitor host="catalog-prod-catalog_servicemonitorv1-.ip-100-64-134-134-cn-northwest-1a" app:MERCH-VALUE_ADDED_SERVICES-V1 instanceId:i-0ebd2cd66d8584cb4
| rex field=_raw ", asg:(?<asgn>[\\w-]*),"
| rex field=_raw ", instanceId:(?<in>[\\w-]*)"
| table in asgn
| stats count by in asgn
index=app app=servicemonitor (error OR failed OR failure)
| rex field=_raw " method:(?<mname>[a-zA-Z0-9]*), "
| rex field=_raw " app:(?<appname>[a-zA-Z0-9_-]*), "
| stats count by mname appname
替换操作:
index= aliyun sourcetype=ali_formatted_cdn (message.reqPath="/merch/*" NOT message.reqPath="*batch*")
| replace /merch/products/v* with merchproducts in message.reqPath
| replace /merch/skus/v* with merchskusv2 in message.reqPath
| replace /merch/value_added_services/v* with vasv1 in message.reqPath
| replace /merch/contents/v* with productcontentservice in message.reqPath
| replace /merch/prices/v* with merchpricesv2 in message.reqPath
| stats avg(netPerf.downloadTime) as avgDownloadTime,p95(netPerf.downloadTime) as p95DownloadTime,max(netPerf.downloadTime) as maxDownloadTime by message.reqPath
| eval avgDownloadTime=avgDownloadTime/1000, p95DownloadTime=p95DownloadTime/1000, maxDownloadTime=maxDownloadTime/1000
index=akamai message.reqHost=api.xx.com geo.country=CN
| fields message.reqPath
| rex mode=sed field=message.reqPath "s/%2f/\//g"
| rex mode=sed field=message.reqPath "s/[a-fA-F0-9]{8}-([a-fA-F0-9]{4}-){3}[a-fA-F0-9]{12}/{uuid}/g"
| search message.reqPath="/product_feed/*"
| stats count by message.reqPath
统计YN比率
index= aliyun sourcetype=ali_formatted_cdn message.reqPath ="/xxx/contents*"
| eval gt1s=if('netPerf.downloadTime'>1000, "Y", "N")
| stats count by gt1s
index= aliyun sourcetype=ali_formatted_cdn ( message.reqPath="/xx/contents*")
| eval hit=if(like('netPerf.cacheStatus', "HIT%"), "Y", "N")
| stats count by hit
统计区间event数量最大值:
index=web source="/var/log/xx/productcontent/access.log" | bin span=1s _time | top 1 _time
index=aliyun sourcetype=ali_formatted_cdn message.reqPath="/merch/contents*" | bin span=1s _time | top 1 _time
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
· 【译】Visual Studio 中新的强大生产力特性
· 2025年我用 Compose 写了一个 Todo App