Reporting

New Line Break Character with Sendemail message (Splunk 6.1.4)

tony_14
New Member

So I'm trying to pipe a search query to sendemail to email specific messages based on search results and format the message/body of that email to use line breaks and paragraphs rather than one long message. (Splunk 6.1.4)

search query | sendemail to=email_address from=from_email subject=alert_subject message="Alert first line \r\n second line with $result.Field$ \r\n third line"

I've tried:
\n
\r\n
\r\n\r\n
\n\r
[\r\n]
[\n\r]

No luck. And I know it's not outlook messing up the message because the default footer is correctly displayed with proper line breaks. The default footer should be: "If you believe you've received this email in error, please see your Splunk administrator.\r\n\r\nsplunk > the engine for machine data." according to the documentation but \r\n doesn't seem to work for me.

I can format the message correctly using the built in alert tool but I can't customize the FROM address using the alert app, so trying to get sendemail to work.

http://docs.splunk.com/Documentation/Splunk/6.1.4/SearchReference/Sendemail

0 Karma

bjoernjensen
Contributor

Hi,

you might want to try Shift + Enter to get a newline within the search query.

Moreover: If you would like to have your result embedded in a certain text, you should form your search in a way everything fits in one event and one field (😞
... | eval raw="This is my first value: " + file + ", and<<*Shift+Enter
>>
my second value: " + 'file' + "." | table raw | rename raw as _raw | sendemail format=raw sendresults=true ... message="welcome message"

To archive this (*), you may have to use commands like transpose, foreach, xyseries, untable

Cheerz

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...