Splunk Search

Why does the map search break my base search?

andrew_burnett
Path Finder

So I have this search looking to send emails to people logging into a legacy SH, but the map command breaks my results. 

 

index=_audit sourcetype = audittrail action="login attempt"|eval user=user.""."@gmail.com"|fields user|map search="sendemail to=$user$ subject=Please Stoping Using Old SH message="Please migrate to new SH" sendresults=true inline=true format=raw"

Labels (1)
0 Karma

isoutamo
SplunkTrust
SplunkTrust
You can check from python.log what are those arguments which have sent by sendemail.
0 Karma

bowesmana
SplunkTrust
SplunkTrust

In what way does it break the results. By 'base search' do you mean a base search in a dashboard?

One comment about the search. You are double quoting the message string but not subject. 

0 Karma

andrew_burnett
Path Finder

I mean that the base search I mean the part of the search before the map command

0 Karma

bowesmana
SplunkTrust
SplunkTrust

I suggested you quote the subject string, like you have quoted the message string - did you do that?

Can you also give us some indication of what 'it is broken' means - can you describe or upload a screenshot of what 'broken' means

 

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

A search is a pipeline of processing instructions for events - processing further down the pipeline cannot directly affect processing higher up in the pipeline.

How do you know it is "broken"?

0 Karma

andrew_burnett
Path Finder

Everything before the map command works, until I add that last half.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Do you need to escape the double quotes used in the search string?

0 Karma

andrew_burnett
Path Finder

In the eval? That's to actually make them into email strings

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Something like this (untested)

index=_audit sourcetype = audittrail action="login attempt"|eval user=user.""."@gmail.com"|fields user|map search="sendemail to=$user$ subject=\"Please Stoping Using Old SH\" message=\"Please migrate to new SH\" sendresults=true inline=true format=raw"
0 Karma

andrew_burnett
Path Finder

I don't need to escape them, but it is still broken.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Have you tried it with escaped quotes?

index=_audit sourcetype = audittrail action="login attempt"|eval user=user.""."@gmail.com"|fields user|map search="sendemail to=\"$user$\" subject=\"Please Stoping Using Old SH\" message=\"Please migrate to new SH\" sendresults=true inline=true format=raw"
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...