Splunk Search

Help with Timechart search

chriscioffi88
New Member

Hi there,

I am just trying to get my head around a visualization that I want to create.

Scenario:

To identify outliers in volumes of traffic.

I want to add together the total bytes (to be displayed on the X axis), and display them against days and hours of a given day (to be displayed on the Y axis). On the scatter graph I would like to see a different line for the day of the week.

..| stats sum(bytes) as total_bytes by date_wday, date_hour

This plots each date_wday on the visualization on the same line. I would like them separated so that I would have each individual weekday represented on the visualization.

Hope that makes sense.

0 Karma

jitendragupta
Path Finder

In this case it is difficult to show total_bytes on X-axis. You can try below code with date_hour on X-axis, total_bytes on Y-axis and date_wday shown with different colors.

<base query> | rename _time as Time | eval date_wday=strftime(Time,"%d/%m/%Y") | eval date_hour=strftime(Time,"%H") | stats sum(bytes) as total_bytes by date_wday, date_hour | fillnull | where total_bytes>=0 | table date_wday date_hour  total_bytes

alt text

0 Karma

chriscioffi88
New Member

Apologies, I meant total bytes on the Y and the date_hour on the X - more or less exactly like your visualization.

I used your code, thank you 🙂 but it is not matching any events or sticking any data into tables.

I am going to try and troubleshoot this myself, but if you have any idea why, please let me know 🙂

Thanks

0 Karma

chriscioffi88
New Member

Blockquote
| rename _time as Time | eval date_wday=strftime(Time,"%d/%m/%Y") | eval date_hour=strftime(Time,"%H") | stats sum(bytes) as total_bytes by date_wday, date_hour | fillnull | where total_bytes>=0 | table date_wday date_hour total_bytes

So because we are eval date_wday and date_hour, I am not able to use them for the functions. Is there a way around this?

0 Karma

jitendragupta
Path Finder

I gave u a general solution using index=_internal because I don't know your actual query. If solution matches your requirements then u can modify it as per the need.

0 Karma

chriscioffi88
New Member

Ok I will give it a go, but the visualization you have generated is perfect.

0 Karma

khristian_p
Engager

Have you tried timechart span=1d count by total_bytes . This should display results on a per-day basis.

https://docs.splunk.com/Documentation/Splunk/7.3.0/SearchReference/Timechart

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!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...