Splunk Search

Table Formatting

tmarlette
Motivator

I am having some difficulty formatting a table the way I would like.
I am monitoring port state for a couple different ports on a few different machines.

Currently this is my search string:
sourcetype=port_scan (dst_port=443 OR dst_port=80 OR dst_port=4000 OR dst_port=43500 OR dst_port=43501) | dedup dest_ip | stats latest(dst_port_state) AS "state" by _time,dest_ip,dst_port,dest_host

This is what my output looks like:
alt text

I was wondering if anyone knew a way for it to look like this:

time, dest_ip, dest__host,"80 state", "4000 state"

12:00pm, 10.10.10.10,hostname, UP, DOWN

I'm thinking that I would need to make each port a field, and then report their status, but I don't know i'm missing an easier way?

Tags (2)
0 Karma

somesoni2
Revered Legend

Try this workaround

sourcetype=port_scan (dst_port=443 OR dst_port=80 OR dst_port=4000 OR dst_port=43500 OR dst_port=43501) | dedup dest_ip| eval allfields=strftime(_time,"%Y-%m-%d %H:%M:%S").",".dest_ip.",".dest_host | eval dst_port =dst_port." State"| chart latest(dst_port_state) AS "state" over allfields  by dst_port | rex field=allfields "(?<Time>.*),(?<dest_ip>.*),(?<dest_host>.*)" | fields - allfields
0 Karma

tmarlette
Motivator

This works really well for reporting, but what if I wanted to run a realtime search?

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!

Monitoring AI Agents with Splunk Observability Cloud

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...

[Puzzles] Solve, Learn, Repeat: Tiling

This puzzle (first published here) is based on finding groups of tessellated tiles (inspired by floor tiles I ...

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...