Splunk Search

How can I do stats by eventtype?

daniel333
Builder

All,

I have three eventtypes

[insecure_telnet]
app=telnet OR dest_port=23

[insecure_snmp]
app=snmp OR dest_port=1234

[insecure_rdp]
app=rdp OR dest_port=4321

I'd like the email alert I get to have the protocol I don't trust in the email header.
e.g.
ALert - insecure Service TELNET detected on HOST

Rather than write an alert for each insecure protocol I don't trust I was hoping just to bind all these together like

index=os eventtype=insecure_telnet OR eventtype=insecure_snmp

I figured I can stats by eventtype, but that doesnt' quite cut it since it includes other eventtypes. Is there maybe a way to use eventstats or a eval to create a field which states the insecure protocol?

Tags (2)
0 Karma
1 Solution

xpac
SplunkTrust
SplunkTrust

Hey, you can either reduce your result like this:

| stats by eventtype
| where eventtype=insecure_telnet OR eventtype=insecure_snmp OR eventtype=insecure_rdp

You could also create a new eval'd field like this:

| eval insecure_protocol=case(app=telnet OR dest_port=23, "telnet", app=snmp OR dest_port=1234, "snmp", app=rdp OR dest_port=4321, "rdp")

Both is possible 😉

Hope that helps - if it does I'd be happy if you would upvote/accept this answer, so others could profit from it. 🙂

View solution in original post

xpac
SplunkTrust
SplunkTrust

Hey, you can either reduce your result like this:

| stats by eventtype
| where eventtype=insecure_telnet OR eventtype=insecure_snmp OR eventtype=insecure_rdp

You could also create a new eval'd field like this:

| eval insecure_protocol=case(app=telnet OR dest_port=23, "telnet", app=snmp OR dest_port=1234, "snmp", app=rdp OR dest_port=4321, "rdp")

Both is possible 😉

Hope that helps - if it does I'd be happy if you would upvote/accept this answer, so others could profit from it. 🙂

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!

Catalog Is Now Generally Available on Splunk Cloud Platform

A Unified View of Your Data  Security logs, application events, business data, and historical telemetry often ...

Developer Spotlight with Eduard Lekanne

From Network Engineer to Building Agentic AI for Splunk Eduard Lekanne has been architecting technology ...

From Data Landing to Insight

Search Across More of Your Data Ecosystem The data you need may live in Splunk, high-volume machine data, ...