Splunk Search

Statistics data in GB, MB values

jeganl
Engager

Hi Ninjas, I'm trying to make a table that should list date, domains, action_types, action_type_usage_in_MB, Domain_usage_in_GB. Here is my query inprogress:

 

sourcetype=access_combined domain=abc 
| eval raw_len1=(len(_raw)/(1024*1024*1024)) 
| stats sum(raw_len1) as Domain_usage_in_GB by domain, action_type, _time 
| eval raw_len2=(len(Domain_usage_in_GB)/(1024)) 
| stats list(action_type) as action_type, list(raw_len2) as action_type_usage_in_MB, sum(Domain_usage_in_GB) as Domain_usage_in_GB by domain 
| sort -Domain_usage_in_GB

 

Here is the output:

result.png

Expected Output:

Expected result.png

Challenges:

  1. with my query, the GB to MB conversion happening is not happening properly

  2. Need to round of MB and GB values

  3. Date formating

Could you please help me achieve the data 🙂

Labels (1)
0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @jeganl,

Please try below query;

sourcetype=access_combined domain=abc 
| eval raw_len=len(_raw) 
| stats sum(raw_len) as Domain_usage by domain, action_type, _time 
| eval raw_len2=Domain_usage/1024/1024 
| stats list(_time) as _time list(action_type) as action_type, list(raw_len2) as action_type_usage_in_MB, sum(Domain_usage) as Domain_usage_in_GB by domain 
| eval Domain_usage_in_GB=Domain_usage_in_GB/1024/1024/1024 
| sort -Domain_usage_in_GB

 

If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @jeganl,

Please try below;

sourcetype=access_combined domain=abc 
| eval raw_len=len(_raw) 
| stats sum(raw_len) as Domain_usage by domain, action_type, _time 
| eval raw_len2=Domain_usage/1024/1024 
| stats list(_time) as _time list(action_type) as action_type, list(raw_len2) as action_type_usage_in_MB, sum(Domain_usage) as Domain_usage_in_GB by domain 
| eval Domain_usage_in_GB=Domain_usage_in_GB/1024/1024/1024 
| sort -Domain_usage_in_GB
If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...