Splunk Search

How to create a stat table that has columns that represent the same time range per week.

DandeGuzman
New Member

I have this basic query and would like to create a stat table that shows the result for the last 3 weeks for the same datetime range.

ourcetype=iis tag=webserver cs_uri_stem="/SearchQuery*" |stats avg(TimeTakenMS) by cs_uri_stem

Thanks in advance!

Tags (3)
0 Karma

stephanefotso
Motivator

Hello! Try this:

    sourcetype=iis tag=webserver cs_uri_stem="/SearchQuery*" earliest=-3w@w latest=now |bucket span=7d _time|stats avg(TimeTakenMS) by cs_uri_stem, _time
SGF
0 Karma

DandeGuzman
New Member

Hi Stephane I am actually aiming for a result that will look something like this:

cs_uri_stem           Week1   Week2   Week3
/SearchQuery1          123     122     110
/SearchQUery2          43       54     49

I am trying to tweak what you have given though it should be near enough.

Thank you so much.

0 Karma

stephanefotso
Motivator

Here is what i can do for you. Instead of Week1, Week2, ... in your table, you can say, week of 10/April, week of 18/April......

Something like this:

  sourcetype=iis tag=webserver cs_uri_stem="/SearchQuery*" earliest=-3w@w latest=now |bucket span=7d _time| eval day_week=strftime(_time, "%d/%b")|replace * with "week of *" in day_week|stats avg(TimeTakenMS) by cs_uri_stem, day_week
SGF
0 Karma

vganjare
Builder

Can you please share the expected output?

Thanks!!

0 Karma

DandeGuzman
New Member

Hi I am trying to get this output:

cs_uri_stem           Week1   Week2   Week3
/SearchQuery1          123     122     110
/SearchQUery2          43       54     49

where week columns are derived from the same daytime value per week.

TIA

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...