Splunk Search

How to rearrange columns in a timechart result?

Allampally
Path Finder

Hi,

I have a timechart result with two columns as shown in the 1st screenshot.
Hour column contain a count for each hour. I want to rearrange this table as shown in the "result" screenshot

alt text
alt text

0 Karma
1 Solution

datasearchninja
Communicator

To be explicit on the bin, you could replace your timechart command with:

| bin _time span=1h
| stats count by _time

Either way, after this calculate the day and hour values, and then populate a table:

| eval day=strftime(_time, "%m/%d/%Y") 
| eval hour=strftime(_time, "%H:%M") 
| maketable hour day count

View solution in original post

0 Karma

harishalipaka
Motivator

add this end of your quer..

| transpose header_field=day 
| fields - column
Thanks
Harish
0 Karma

datasearchninja
Communicator

To be explicit on the bin, you could replace your timechart command with:

| bin _time span=1h
| stats count by _time

Either way, after this calculate the day and hour values, and then populate a table:

| eval day=strftime(_time, "%m/%d/%Y") 
| eval hour=strftime(_time, "%H:%M") 
| maketable hour day count
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...