Splunk Search

How to edit my search using the "map" command?

tmontney
Builder

I have two searches I want to be run in a real-time alert. I've never used map before, but this is what I have. It's not returning any results.

index="eventlog" AND case(EventCode=4624 AND (host=HOST1 OR host=HOST2 OR host=HOST3),
map search="search index='eventlog' AND (Logon_Type=2 OR Logon_Type=7 OR Logon_Type=10) AND Logon_GUID!={00000000-0000-0000-0000-000000000000}
| eval Title=user.' ... '.host 
| eval Body='Logon Type is '.Logon_Type.' '.Message",
EventCode=20274 AND (host=HOST4 OR host=HOST5),
map search="search index='eventlog'
| eval part1=split(body, 'user') 
| eval temp=mvindex(part1, 1) 
| eval part2=split(temp, 'connected') 
| eval temp2=mvindex(part2, 0) 
| eval usernameSplit=split(temp2, '\\')
| eval username=mvindex(usernameSplit,1)
| eval Title=username.' ... VPN RAS Logon ... '.host
| eval Body='The alert condition for *VPN Logon* was triggered.'")
| table Title Body
0 Karma

DalJeanis
Legend

It seems like at the very least you are missing a pipe character where the comma is after .message"

Look at what you posted, and notice the green is code inside of quotes (single or double).

You have EventCode=20274 just sort of sitting there, not associated with a search. and no pipe before the following map command.

0 Karma

somesoni2
Revered Legend

The map syntax is wrong. See map documentation for correct usage. https://docs.splunk.com/Documentation/Splunk/6.5.1/SearchReference/Map

Also, real-time alerts are not efficient and if you can mange with a delay of few minutes, I would suggest to setup a regular/historical search alert.

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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...