Splunk Search

How to change host as row and time as column

Zodi_6
New Member

Hi there, I have this query:

index=_internal source="*license_usage.log"
| eval bytes=b
| eval GB = round(bytes/1024/1024/1024,3)
| timechart span=1d sum(GB) by h

This query shows results like this:

_time host1 ....
2023-11-10    
2023-11-11    
...    

 

And I want results like this:

Host 2023-11-10 ....
host1    
host2    
...    

 

How I can do this?

Labels (2)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Zodi_6 ,

see the transpose command at https://docs.splunk.com/Documentation/Splunk/9.1.2/SearchReference/Transpose and, please, try:

index=_internal source="*license_usage.log"
| eval bytes=b
| eval GB = round(bytes/1024/1024/1024,3)
| timechart span=1d sum(GB) by h
| transpose 0 column_name=h header_field_time 

Ciao.

Giuseppe

0 Karma

yuanliu
SplunkTrust
SplunkTrust

Use chart.

index=_internal source="*license_usage.log"
| eval bytes=b
| eval GB = round(bytes/1024/1024/1024,3)
| bucket _time span=1d
| eval _time = strftime(_time, "%F")
| chart sum(GB) over h by _time
Tags (1)
0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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