Splunk Search

Timechart problem

Kelvin_Perez
New Member

Hi:

I'm new to Splunk and I've been trying to run the following query for a couple of weeks but I only get data for the current date:

sourcetype="bcoat_proxysg" action!="TCP_HIT" | eval P1=split(proxy_server,"G")|eval GW=mvindex(P1,0)|eval Gateway=if(GW = "xx1","Site1", if(GW="xx2","Site2", GW))|eventstats sum(cs_bytes) as dl by Gateway|timechart count(eval(dl/1048576)) as "Download (MBytes)" by Gateway span=24h

OR

sourcetype="bcoat_proxysg" action!="TCP_HIT" | eval P1=split(proxy_server,"G")|eval GW=mvindex(P1,0)|eval Gateway=if(GW = "xx1","DCW", if(GW="xx2","DCE", GW))|eventstats sum(cs_bytes) as dl by Gateway|bucket _time span=24h|convert timeformat="%m/%d/%Y" ctime(_time) AS c_time|chart count(eval(dl/1048576)) as "Download (MBytes)" over c_time by Gateway

In short, I'm trying to get the downloads (sc_bytes) in Megabytes (the information is provided in bytes) by Gateway per day.

Can anybody point me to what I am doing wrong?

Thanks!

Tags (3)
0 Karma

kristian_kolb
Ultra Champion

Firstly, I managed to produce some results with your search, though I had to modify it to work with access_combined, (bytes instead of cs_bytes, clientip instead of Gateway etc)

I think you are using count in the wrong way, at least if you want to find the amount of data being transferred. Try the eval for the bytes -> megabytes first, and make a sum in the timechart.

sourcetype="bcoat_proxysg" action!="TCP_HIT" | eval P1=split(proxy_server,"G")|eval GW=mvindex(P1,0)|eval Gateway=if(GW = "xx1","Site1", if(GW="xx2","Site2", GW))| eval MB=cs_bytes/1024/1024| timechart sum(MB) as "Download (MBytes)" by Gateway span=24h

Hope this helps,

Kristian

0 Karma

Kelvin_Perez
New Member

Hi Kristian:Thanks a lot for the example! Seems to be working better. However, I'm still getting data only for the current date or the last date in the selected custom range. All other dates return no data.:(

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!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Enhance Security Operations with Automated Threat Analysis in the Splunk EcosystemAre you leveraging ...

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...