<?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: Combine multiple events for reporting in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171295#M49050</link>
    <description>&lt;P&gt;Sorry for type. I mean to say that replace "sourcetype=email" with whatever sourcetype you're using. Updated the answer now.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Dec 2013 07:04:29 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2013-12-09T07:04:29Z</dc:date>
    <item>
      <title>Combine multiple events for reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171292#M49047</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm using splunk for caching the log and reporting, now I need to query in splunk for user action and generate a report. My case will be showed as following&lt;/P&gt;

&lt;P&gt;I had several events in a log like :&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;e1: [&lt;A href="mailto:email1@test.com"&gt;email1@test.com&lt;/A&gt;] Login system with username:email1&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;e2: [&lt;A href="mailto:email1@test.com"&gt;email1@test.com&lt;/A&gt;] Read articleId:art1&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;e3: [&lt;A href="mailto:email1@test.com"&gt;email1@test.com&lt;/A&gt;] Read articleId:art2&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;e4: [&lt;A href="mailto:anotheremail1@test.com"&gt;anotheremail1@test.com&lt;/A&gt;] Login system with username:email2&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Now I want to list all actions made by user who read article with articleId is art1. Which search statement can help me?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 05:52:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171292#M49047</guid>
      <dc:creator>ndkhoiits</dc:creator>
      <dc:date>2013-12-09T05:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple events for reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171293#M49048</link>
      <description>&lt;P&gt;Try below query. Replace "email" with sourcetype of yours:-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=email | rex "\[(?P&amp;lt;User&amp;gt;[^@]+)" | search [search sourcetype=email | rex "\[(?P&amp;lt;User&amp;gt;[^@]+)" | rex "\] (?P&amp;lt;Action&amp;gt;[^:]+):(?P&amp;lt;Item&amp;gt;.+)"| table _raw, User, Action,Item | where Action="Read articleId" AND Item="art1"| table User]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Dec 2013 06:12:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171293#M49048</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-12-09T06:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple events for reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171294#M49049</link>
      <description>&lt;P&gt;Hi @somesoni2, what you mean about &lt;CODE&gt;sourcetype&lt;/CODE&gt; command in your query?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 06:23:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171294#M49049</guid>
      <dc:creator>ndkhoiits</dc:creator>
      <dc:date>2013-12-09T06:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple events for reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171295#M49050</link>
      <description>&lt;P&gt;Sorry for type. I mean to say that replace "sourcetype=email" with whatever sourcetype you're using. Updated the answer now.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 07:04:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171295#M49050</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-12-09T07:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple events for reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171296#M49051</link>
      <description>&lt;P&gt;I used your query and always returns no result for that&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 09:28:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171296#M49051</guid>
      <dc:creator>ndkhoiits</dc:creator>
      <dc:date>2013-12-09T09:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple events for reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171297#M49052</link>
      <description>&lt;P&gt;Best case: extract the fields for email, action and article. Then your search will look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere [ search action=Read article="art1" | dedup email | fields email ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you must create the fields on-the-fly, the search becomes much more complex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere [ search yousearchhere  "art1" 
| rex "\[(?&amp;lt;email&amp;gt;\S+@\S+)\]\s(?&amp;lt;action&amp;gt;\S+)\s.*?\:(?&amp;lt;article&amp;gt;.*)"
| search action=Read article=art1 | dedup email | fields email ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You might want to read the documentation on &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0/Knowledge/Addfieldsatsearchtime#Use_interactive_field_extraction_to_create_new_fields"&gt;creating field extractions&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2013 15:57:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171297#M49052</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-12-16T15:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple events for reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171298#M49053</link>
      <description>&lt;P&gt;What is your source/log file name? instead of "sourcetype=email", use "source=&amp;lt;&lt;NAME of="" your="" log="" file=""&gt;&amp;gt;" and try.&lt;/NAME&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2013 19:13:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-for-reporting/m-p/171298#M49053</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-12-16T19:13:52Z</dc:date>
    </item>
  </channel>
</rss>

