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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

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