当前位置:网站首页>The single value view in Splunk uses to replace numeric values with text
The single value view in Splunk uses to replace numeric values with text
2022-07-07 08:22:00 【QYHuiiQ】
stay splunk Of single value In the view , Before, we used to display colors directly according to values , That is to say single value What value is used in , Then the color setting is displayed according to this value , In other words , The value of this display must be the value of setting color rules . In some cases, we may just want to show the name of an indicator , Then set the color according to the value of this indicator , That is to say, change the original display value to display indicator name , Do not show specific values , But still set the color with this value .
In this case , Our implementation idea is to show by value , Finally, replace this value with the index name ( Text ).
Suppose the original situation is like this , When grade Greater than 60 Green when , Less than or equal to 60 when , Show red , Note that our view in this building is based on grade Set the color with the value of , And will grade Show the value of :
| makeresults
| eval grade="37"
| table grade
What we need to achieve now is , Change the displayed value into the indicator name / Text , The color rules remain the same .
If we use replace Replace the final displayed value , So use " Format " The color rules set in will naturally become invalid , because " Format " The rule in is spl It will take effect after the execution , Take a look at this test :
| makeresults
| eval grade="37"
| table grade
| replace "37" with "Student Grade" in grade
Because the final value is replaced by text , Therefore, the rule setting of this numerical type is invalid , The final display is gray .
therefore , The method we need to use is to use Splunk An official one rangemap To help us set the color , And then again replace Text , The implementation method is as follows :
| makeresults
| eval grade="37"
| rangemap field=grade low=61-100 severe=0-60 default=gray
# here low and severe They correspond to green and red respectively , This is a Splunk The official default configuration , You can refer to other use cases in official documents .
# If the color rule you want to set is a specific value rather than a range , Then you can set it to - The values before and after are the same , Set it to the value you want to define . Such as :| rangemap field=grade low=60-60 severe=100-100 default=gray
At this time, you need to pay attention to " Format " Disable the color in , Because we are through spl Inside rangemap To set the color .
After setting the color , Start replacing displayed values :
| makeresults
| eval grade="87"
| rangemap field=grade low=61-100 severe=0-60 default=gray
| replace "87" with "Student Grade" in grade
#replace The next first parameter is the replaced value ,with Followed by the replaced value ,in The next one is to replace the value in which field
At this point, the value displayed in the view becomes a custom text , It has nothing to do with the value behind the color setting , It should be noted that replace The latter value is only when grade The value of the field is "87" Will be replaced when , Otherwise, it will not be replaced .
Here I'm just an example of value substitution , But in practice replace The value of may vary , So we need to adjust the logic according to the business .
That's through rangemap and replace Realization single value Replace the display value in , For more use cases, please refer to the official documents :
边栏推荐
- The legend about reading the configuration file under SRC
- ZCMU--1492: Problem D(C语言)
- Quick analysis of Intranet penetration helps the foreign trade management industry cope with a variety of challenges
- 雅思考试自己的复习进度以及方法使用【日更版】
- eBPF Cilium实战(1) - 基于团队的网络隔离
- Pvtv2--pyramid vision transformer V2 learning notes
- [step on the pit series] H5 cross domain problem of uniapp
- [quick start of Digital IC Verification] 11. Introduction to Verilog testbench (VTB)
- ROS bridge notes (05) - Carla_ ackermann_ Control function package (convert Ackermann messages into carlaegovehiclecontrol messages)
- 漏洞複現-Fastjson 反序列化
猜你喜欢
电池、电机技术受到很大关注,反而电控技术却很少被提及?
[quick start of Digital IC Verification] 11. Introduction to Verilog testbench (VTB)
Tuowei information uses the cloud native landing practice of rainbow
Vulnerability recurrence fastjson deserialization
[quick start of Digital IC Verification] 14. Basic syntax of SystemVerilog learning 1 (array, queue, structure, enumeration, string... Including practical exercises)
单场带货涨粉10万,农村主播竟将男装卖爆单?
Battery and motor technology have received great attention, but electric control technology is rarely mentioned?
解读创客思维与数学课程的实际运用
解析机器人科技发展观对社会研究论
拓维信息使用 Rainbond 的云原生落地实践
随机推荐
Unityhub cracking & unity cracking
Bayes' law
Quick analysis of Intranet penetration helps the foreign trade management industry cope with a variety of challenges
Splunk中single value视图使用将数值替换为文字
Using nocalhost to develop microservice application on rainbow
GFS分布式文件系统
拓维信息使用 Rainbond 的云原生落地实践
Domain specific language / DSL in kotlin
Rainbow version 5.6 was released, adding a variety of installation methods and optimizing the topology operation experience
Blob 對象介紹
Qinglong panel -- Huahua reading
Rainbond 5.6 版本发布,增加多种安装方式,优化拓扑图操作体验
What is the function of paralleling a capacitor on the feedback resistance of the operational amplifier circuit
One click installation of highly available Nacos clusters in rainbow
Explore creativity in steam art design
Famine cloud service management script
The largest 3 same digits in the string of leetcode simple question
Rainbond结合NeuVector实践容器安全管理
在Rainbond中实现数据库结构自动化升级
Using helm to install rainbow in various kubernetes