Splunk Search

How do I add a new field in the output?

rajhemant26
New Member

Hello everyone.

Want to display the output only for the time which crosses 18 months (earliest time)

Tags (1)
0 Karma

Vijeta
Influencer

In your stats command you can add Req in by clause, if that is what you want as output . See below-

 stats avg(RequestsPerSec) as AvgRequestsPerSec , max(RequestsPerSec)  as MaxRequestsPerSec , p95(RequestsPerSec) as P95RequestsPerSec  by Req host_type _time
0 Karma

Vijeta
Influencer

You can use bin and stats instead of timechart-

 host=pcde* sourcetype=qwedc

 | eval host_type=case(host LIKE "%raf%", "RAF", host LIKE "%tap%", "TAP", host LIKE "%dft%", "DFT" 
 | streamstats count as Req by host_type 
 | eval RequestsPerMin=Req/24/60
 | eval RequestsPerSec=RequestsPerMin/60
|bin span=5m _time| stats avg(RequestsPerSec) as AvgRequestsPerSec , max(RequestsPerSec)  as MaxRequestsPerSec , p95(RequestsPerSec) as P95RequestsPerSec  by host_type _time
 |eval AvgRequestsPerSec=round(AvgRequestsPerSec,2), MaxRequestsPerSec=round(MaxRequestsPerSec,2), P95RequestsPerSec=round(P95RequestsPerSec,2) 
 |sort -MaxRequestsPerSec, -P95RequestsPerSec
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

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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