Splunk Search

Covert KB to MB in a chart count search.

pdantuuri0411
Explorer

I have a chart count of Index using License usage using the below search. The search works fine but how to convert the usage from KB to MB.

index=_internal source=license_usage.log type="usage" idx=* earliest_time=-7d@d | convert timeformat="%F" ctime(_time)
| chart count over idx by _time | eval Time=strftime(_time,"%m-%d")

Thank you

0 Karma
1 Solution

tauliang
Communicator

You can add an extra line in the end to flip the axes

    | transpose

View solution in original post

tauliang
Communicator

You can add an extra line in the end to flip the axes

    | transpose

pdantuuri0411
Explorer

Thank you. This helped few a few minor changes.

0 Karma

tauliang
Communicator

Try this: divide "b" by 1024*1024=104857, you will get the usage in MB:

index=_internal source=*.log source="license_usage.log"
type="usage" idx=* earliest_time=-7d@d
|eval UsageInMB = round(b/1048576,2) 
| convert timeformat="%F" ctime(_time)
| chart sum(UsageInMB) over idx by _time 
| eval Time=strftime(_time,"%m-%d")

pdantuuri0411
Explorer

Thank you @tauliang for the reply. I tried what you just posted by it did not convert from KB to MB. below is the result I got.

i_apache_coc 4771 4608 4650 4734 4814 5102 3454
i_apache_revproxy_24 5227 4989 4156 4090 4879 4729 4845

0 Karma

tauliang
Communicator

Interesting. If somehow it doesn't work for you, I suggest downloading this app

https://splunkbase.splunk.com/app/2949/

and see if it shows all the meta data correctly.

0 Karma

pdantuuri0411
Explorer

Unfortunately I dont have permissions to download apps for our splunk environment.

Strange thing is, when I tried the same chart using time chart[1], I am able to retrieve data in MB. The issue was I wanted to swap X axis and Y axis, so I modified the search to use chart count. Any other suggestions?

[1]
index=_internal source=license_usage.log type="Usage" idx=* earliest_time=@w
| timechart span=1d limit=0 eval(round(sum(b)/1024/1024,3)) as MB by idx | sort -_time

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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...