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!

From Data to Insight: Announcing the Winners of the Splunk Dashboard Contest

Hi Splunkers, First off, thank you to everyone who participated in our very first From Data to Insight: The ...

Splunk Developers: Construct Your Future at the .conf26 Builder Bar

Calling all Splunk architects, platform admins, and app developers: the site is open, and the blueprints are ...

Quick connection discovery mode for forwarders

When a Splunk forwarder loses connectivity to its indexers, it does not always reconnect immediately. In many ...