Splunk Search

Get numbers between event

pudanelilita
Explorer

Hi,
I would like to get Heap number, from event:
[Eden: 704.0M(5804.0M)->0.0B(5800.0M) Survivors: 52.0M->56.0M Heap: 7961.8M(15.0G)->7271.4M(15.0G)]

And get:
7961.8

Tags (1)
0 Karma
1 Solution

skoelpin
SplunkTrust
SplunkTrust

Add this, your field name will be called HeapNum

| rex Heap:\s(?<HeapNum>\d+\.\d)\w

View solution in original post

0 Karma

skoelpin
SplunkTrust
SplunkTrust

Add this, your field name will be called HeapNum

| rex Heap:\s(?<HeapNum>\d+\.\d)\w
0 Karma

pudanelilita
Explorer

Thanks you a lot @skoelpin !
And, if I want to take number, which is in () brackets?

skoelpin
SplunkTrust
SplunkTrust

If the number is in the parenthesis and you want to exclude it, you would do something like this

| rex Heap:\s\((?<HeapNum>\d+\.\d)\)\w
0 Karma

pudanelilita
Explorer

Also for some reason, when I try with Metaspace, it shows no outputs.
Event:
[Eden: 180.0M(6104.0M)->0.0B(6104.0M) Survivors: 0.0B->0.0B Heap: 3159.0M(12.0G)->2979.3M(12.0G)], [Metaspace: 535433K->535433K(1574912K)]

| rex Metaspace:\s(?\d+\.\d)\w
| table metaspacenum
| head 10

output in Statics there there is noting, just empty tables
tried to exclude with | search metaspacenum!=" "
but it didn't helped

0 Karma

skoelpin
SplunkTrust
SplunkTrust

Like this

| rex Metaspace:\s(?<Metaspace>\d+)

To exclude nulls, like this

| where isnotnull(Metaspace)

0 Karma

pudanelilita
Explorer

Thank you for your replay, @skoelpin !
But if before parenthesis there is numbe like this Heap: 12.8G(15.0G), and 12.8 all the time is changing, and I need 15.0?

0 Karma
Get Updates on the Splunk Community!

Now Available: Cisco Talos Threat Intelligence Integrations for Splunk Security Cloud ...

At .conf24, we shared that we were in the process of integrating Cisco Talos threat intelligence into Splunk ...

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Easily Improve Agent Saturation with the Splunk Add-on for OpenTelemetry Collector

Agent Saturation What and Whys In application performance monitoring, saturation is defined as the total load ...