Security

chart with KG and MB in Y -axis

pudanelilita
Explorer

Hi,
I'm facing issue with chart which displays KG and MB, where MB are bigger by the number, and it shows wrong chart:
Green line needs to be above.

event examples:
Heap: 13.2G
Heap: 6208.6M

How make, that MB are down in the chart?
alt text

My search:
| rex Heap:\s(?<HeapNum>\d+\.\d)\w | search HeapNum!=" " | eval critical=15 | table _time HeapNum critical

Tags (1)
0 Karma
1 Solution

diogofgm
SplunkTrust
SplunkTrust

You should first define what is the base unit you want to work with (Kb, Mb, Gb, etc) . For this lets assume Mb

| rex "Heap:\s(?<HeapNum>[\d\.]+)(?<unit>\w+)"
| search HeapNum!=" " 
| eval HeapNum = case(unit="K", HeapNum/1000,unit="M", HeapNum,unit="G", HeapNum*1000)
| eval critical=15 
| table _time HeapNum critical 

You can change the calculations in the case depending on the selected unit. And then also revise the critical value accordingly.

Hope this helps.

------------
Hope I was able to help you. If so, some karma would be appreciated.

View solution in original post

0 Karma

diogofgm
SplunkTrust
SplunkTrust

You should first define what is the base unit you want to work with (Kb, Mb, Gb, etc) . For this lets assume Mb

| rex "Heap:\s(?<HeapNum>[\d\.]+)(?<unit>\w+)"
| search HeapNum!=" " 
| eval HeapNum = case(unit="K", HeapNum/1000,unit="M", HeapNum,unit="G", HeapNum*1000)
| eval critical=15 
| table _time HeapNum critical 

You can change the calculations in the case depending on the selected unit. And then also revise the critical value accordingly.

Hope this helps.

------------
Hope I was able to help you. If so, some karma would be appreciated.
0 Karma

pudanelilita
Explorer

@diogofgm it gives me error:
Error in 'SearchParser': Missing a search command before '\'. Error at position '130' of search query 'search index="adop-e-prod-jira" source="/mnt/hostl...{snipped} {errorcontext = [\d.]+)(?

0 Karma

diogofgm
SplunkTrust
SplunkTrust

it was missing the rex quotes :S I've updated my answer.

------------
Hope I was able to help you. If so, some karma would be appreciated.
0 Karma

pudanelilita
Explorer

Thank you, @diogofgm that helped!

0 Karma

Sukisen1981
Champion

assuming HeapNum is your MB field | eval HeapNum=round((HeapNum/1000),2)

0 Karma

pudanelilita
Explorer

@Sukisen1981 It also round 13G 😞
but with 3400M it works good!

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...