<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: need some help creating tokens in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347834#M103003</link>
    <description>&lt;P&gt;the results the alert look like this in an email&lt;/P&gt;

&lt;P&gt;Details                           occurrence1&lt;BR /&gt;
Occurred                       2017-1-11  14:56:32+00&lt;BR /&gt;
Alert                               malware-callback&lt;BR /&gt;
SourceIP                        192.168.2.1&lt;BR /&gt;
Hostname                      thiscomputer.company.com&lt;/P&gt;

&lt;P&gt;or &lt;/P&gt;

&lt;P&gt;Details                         occurrence1&lt;BR /&gt;
Recp                             &lt;A href="mailto:somename@domain.tld"&gt;somename@domain.tld&lt;/A&gt;&lt;BR /&gt;
Occurred                     2017-02-23 08:39:41+00&lt;BR /&gt;
Attachment-or-Link   malicious.doc&lt;BR /&gt;
Alert                             malware-object&lt;BR /&gt;
Applicance                 USA-emailscan-01&lt;BR /&gt;
Subj &lt;/P&gt;

&lt;P&gt;Basically this is the format of the email alerts,   I am not able to get the spacing right, but there would be two columns here&lt;/P&gt;</description>
    <pubDate>Tue, 07 Mar 2017 21:36:06 GMT</pubDate>
    <dc:creator>packet_hunter</dc:creator>
    <dc:date>2017-03-07T21:36:06Z</dc:date>
    <item>
      <title>need some help creating tokens</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347828#M102997</link>
      <description>&lt;P&gt;I have a scheduled alert that I need to send to different recipients with different messages depending on the search results, the following is the basic search...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=secApp sourcetype=secApp_json "malware_CB" OR "malware_Obj"
|rename alert.occurred as Occurred 
|stats  
values(alert.name) as Alert  
values(alert.src.ip) as SourceIP 
values(alert.dst.smtp-to) as Recp 
values(alert.src.host) as Hostname 
values(alert.src.url) as Attachment-or-Link 
values(appliance) as Appliance 
values(alert.smtp-message.subject) as Subj  
values(alert.src.smtp-mail-from) as Sender 
values(alert.smtp-message.id) as Msg_ID 
values(alert.smtp-message.smtp-header) as Header 
by Occurred 
|transpose 
|rename column as Details, row* as occurrence* 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now I would like to add a token for alert recipient and a token for alert message...  the following is code I crafted for the alert_msg&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval alert_Msg = case (Appliance = USA-emailscan-01, "msg1", 
Appliance = UK-emailscan-01, "msg2", 
Appliance = USA-netscan-01, "msg3", 
Appliance = UK-netscan-01, "msg4") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;is it possible to use a lookup to populate the message content?  instead of adding the message text directly in the eval statement?&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 20:34:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347828#M102997</guid>
      <dc:creator>packet_hunter</dc:creator>
      <dc:date>2017-03-07T20:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: need some help creating tokens</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347829#M102998</link>
      <description>&lt;P&gt;Not sure if you're getting a field called 'Appliance' after your transpose command, so your case may not be working. If you get that to work, yes, you can use lookup table to do the same. Just create a lookup say appliance_message.csv with fields Appliance and Message and use like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| lookup appliance_message.csv  Appliance OUTPUT Message as alert_Msg
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Mar 2017 20:40:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347829#M102998</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-07T20:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: need some help creating tokens</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347830#M102999</link>
      <description>&lt;P&gt;Thank you, I will give that a try.    I will open another thread for my alert recipients question&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 20:45:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347830#M102999</guid>
      <dc:creator>packet_hunter</dc:creator>
      <dc:date>2017-03-07T20:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: need some help creating tokens</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347831#M103000</link>
      <description>&lt;P&gt;you are correct, the "Appliance" field is not populating... any ideas for a work around?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 20:49:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347831#M103000</guid>
      <dc:creator>packet_hunter</dc:creator>
      <dc:date>2017-03-07T20:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: need some help creating tokens</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347832#M103001</link>
      <description>&lt;P&gt;Can you give me a rough layout of the results (fields, number of rows etc) before transpose?  Any particular reason for doing transpose (or what's the expected format of result)? &lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 21:05:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347832#M103001</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-07T21:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: need some help creating tokens</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347833#M103002</link>
      <description>&lt;P&gt;I do transpose for readability in the email only, otherwise it becomes hard to read&lt;BR /&gt;
I will send the results shortly&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 21:20:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347833#M103002</guid>
      <dc:creator>packet_hunter</dc:creator>
      <dc:date>2017-03-07T21:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: need some help creating tokens</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347834#M103003</link>
      <description>&lt;P&gt;the results the alert look like this in an email&lt;/P&gt;

&lt;P&gt;Details                           occurrence1&lt;BR /&gt;
Occurred                       2017-1-11  14:56:32+00&lt;BR /&gt;
Alert                               malware-callback&lt;BR /&gt;
SourceIP                        192.168.2.1&lt;BR /&gt;
Hostname                      thiscomputer.company.com&lt;/P&gt;

&lt;P&gt;or &lt;/P&gt;

&lt;P&gt;Details                         occurrence1&lt;BR /&gt;
Recp                             &lt;A href="mailto:somename@domain.tld"&gt;somename@domain.tld&lt;/A&gt;&lt;BR /&gt;
Occurred                     2017-02-23 08:39:41+00&lt;BR /&gt;
Attachment-or-Link   malicious.doc&lt;BR /&gt;
Alert                             malware-object&lt;BR /&gt;
Applicance                 USA-emailscan-01&lt;BR /&gt;
Subj &lt;/P&gt;

&lt;P&gt;Basically this is the format of the email alerts,   I am not able to get the spacing right, but there would be two columns here&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 21:36:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347834#M103003</guid>
      <dc:creator>packet_hunter</dc:creator>
      <dc:date>2017-03-07T21:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: need some help creating tokens</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347835#M103004</link>
      <description>&lt;P&gt;the scheduled alerts usually produce 1 result per the time window so in that case (without transpose) there would be 1 row with 10 fields for a malware-Obj&lt;BR /&gt;&lt;BR /&gt;
OR &lt;BR /&gt;
there would be 1 row with 5 fields for a malware-CB&lt;/P&gt;

&lt;P&gt;I hope that makes sense&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 21:56:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347835#M103004</guid>
      <dc:creator>packet_hunter</dc:creator>
      <dc:date>2017-03-07T21:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: need some help creating tokens</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347836#M103005</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=secApp sourcetype=secApp_json "malware_CB" OR "malware_Obj"
 |rename alert.occurred as Occurred 
 |stats  
 values(alert.name) as Alert  
 values(alert.src.ip) as SourceIP 
 values(alert.dst.smtp-to) as Recp 
 values(alert.src.host) as Hostname 
 values(alert.src.url) as Attachment-or-Link 
 values(appliance) as Appliance 
 values(alert.smtp-message.subject) as Subj  
 values(alert.src.smtp-mail-from) as Sender 
 values(alert.smtp-message.id) as Msg_ID 
 values(alert.smtp-message.smtp-header) as Header 
 by Occurred  
| untable Appliance Details Occurence1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The output will be like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Appliance        Details             Occurence1
USA-emailscan-01 Recp                somename@domain.tld
USA-emailscan-01 Occurred            2017-02-23 08:39:41+00
USA-emailscan-01 Attachment-or-Link  malicious.doc
USA-emailscan-01 Alert               malware-object
....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can now add your lookup logic to add a alert_Msg field in the each row. If you want to group an occurrence for an appliance, you can add &lt;CODE&gt;| stats list(Details) as Details list(Occurence1) as Occurence1 by Appliance&lt;/CODE&gt; at the end.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 21:58:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347836#M103005</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-07T21:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: need some help creating tokens</title>
      <link>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347837#M103006</link>
      <description>&lt;P&gt;Thank you.   I will give it a try.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 22:01:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/need-some-help-creating-tokens/m-p/347837#M103006</guid>
      <dc:creator>packet_hunter</dc:creator>
      <dc:date>2017-03-07T22:01:28Z</dc:date>
    </item>
  </channel>
</rss>

