Splunk Search

converted values not displaying after rex and eval

codedtech
Path Finder

I'm trying to run this eval statement, but the only value that dispalys in the y value.

my index|rex mode=sed field=capacity_gb "s/[^\d\.,]//g"|rex mode=sed field=vmdkused_gb "s/[^\d\.,]//g"|eval x = tonumber(capacity_gb)|eval y = tonumber(vmdkalloc_gb)|eval z = y/x| table x,y,z

X           Y         Z
             Y
0 Karma

venkasplunk
New Member

From ur below statement, it looks like you are using wrong filed for value Y.

You extracted rex mode=sed field=vmdkused_gb , but you are using y = tonumber(vmdkalloc_gb) , it should be y = tonumber(vmdkused_gb) ???

index|rex mode=sed field=capacity_gb "s/[^\d.,]//g"|rex mode=sed field=vmdkused_gb "s/[^\d.,]//g"|eval x = tonumber(capacity_gb)|eval y = tonumber(vmdkalloc_gb)|eval z = y/x| table x,y,z

0 Karma

Vijeta
Influencer

can you share your events and what fields are you trying to parse.

0 Karma
Get Updates on the Splunk Community!

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...