Dashboards & Visualizations

how to do a pie chart

fzfeng
New Member

hello guys

I want to make a pie chart of mail size for one mouth

if my record is wrong?

index=maillog I stats count (eval(size<1024))as count1 ,count(eval(size>1024 and size<2048))
as count2,count(eval(size<1024)))as count3

if you know it can you tell me thanks

Tags (1)
0 Karma

niketn
Legend

@fzfeng, if you want count based on various size data taken for a month you can try one of the following:
Option 1: Using transpose command

 index=maillog size=*
| stats count(eval(size<1024)) as "<1024" count(eval(size>1024 AND size<2048)) as "1024> & <2028"  count(eval(size>2048)) as ">2048"
| transpose column_name="size_range"
| rename "row 1" as count

Option 2: Using stats on range

index=maillog size=*
| stats count by size
| eval size_range=case((size<1024),"<1024",(size>1024 AND size<2048),"1024> & <2028",(size>2048),">2048")
| stats count by size_range

Please try out and confirm!

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

p_gurav
Champion
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Your Feedback. Our Roadmap. Visit the PX Feedback Booth at .conf26

You use Splunk every day, come and help shape what's next.  Save Your Seat: Product-Focused Sessions at ...

Agentic SOC Triage: Investigating Splunk ES Notables with MCP Server and a Local LLM

The Problem: Too Many Alerts, Too Little Context Security operations teams running Splunk Enterprise Security ...

Painting a Clearer Picture: Creating Cross-Domain Visibility with AI Canvas

Watch Now Painting a Clearer Picture: Creating Cross-Domain Visibility with AI Canvas     Do you ever feel ...