<?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 Combine multiple events into a new field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-into-a-new-field/m-p/409361#M118092</link>
    <description>&lt;P&gt;I'm attempting to find out when Windows event log service has been stopped/logs cleared but only when a shutdown command hasn't been issued. I'm assuming the best way to do this is to combine all the stopped EventCodes into 1 field, all the shutdown/restart EventCodes into another field, then search based on first &amp;amp; last of those 2 new fields, and remove any null Shutdown events. My questions are:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Is this the best way to approach this problem? If not, what is?&lt;/LI&gt;
&lt;LI&gt;How do you go about combining the following together:&lt;/LI&gt;
&lt;LI&gt; clearedLogs = (EventCode=1102 OR EventCode=1100 OR EventCode=104) &lt;/LI&gt;
&lt;LI&gt;Shutdown = (EventCode=1074 OR EventCode=6006 OR EventCode=6008 OR EventCode=6005 OR EventCode=6009 OR EventCode=1076)&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Mon, 29 Jul 2019 15:48:36 GMT</pubDate>
    <dc:creator>wgawhh5hbnht</dc:creator>
    <dc:date>2019-07-29T15:48:36Z</dc:date>
    <item>
      <title>Combine multiple events into a new field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-into-a-new-field/m-p/409361#M118092</link>
      <description>&lt;P&gt;I'm attempting to find out when Windows event log service has been stopped/logs cleared but only when a shutdown command hasn't been issued. I'm assuming the best way to do this is to combine all the stopped EventCodes into 1 field, all the shutdown/restart EventCodes into another field, then search based on first &amp;amp; last of those 2 new fields, and remove any null Shutdown events. My questions are:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Is this the best way to approach this problem? If not, what is?&lt;/LI&gt;
&lt;LI&gt;How do you go about combining the following together:&lt;/LI&gt;
&lt;LI&gt; clearedLogs = (EventCode=1102 OR EventCode=1100 OR EventCode=104) &lt;/LI&gt;
&lt;LI&gt;Shutdown = (EventCode=1074 OR EventCode=6006 OR EventCode=6008 OR EventCode=6005 OR EventCode=6009 OR EventCode=1076)&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 29 Jul 2019 15:48:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-into-a-new-field/m-p/409361#M118092</guid>
      <dc:creator>wgawhh5hbnht</dc:creator>
      <dc:date>2019-07-29T15:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple events into a new field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-into-a-new-field/m-p/409362#M118093</link>
      <description>&lt;P&gt;Hi wgawhh5hbnht,&lt;BR /&gt;
you could try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog (EventCode=1102 OR EventCode=1100 OR EventCode=104 OR EventCode=1074 OR EventCode=6006 OR EventCode=6008 OR EventCode=6005 OR EventCode=6009 OR EventCode=1076)
| eval type_of_action=if(EventCode="1102" OR EventCode="1100" OR EventCode="104", "clearedLogs", "Shutdown")
| stats earliest(_time) AS earliest latest(_time) AS latest values(type_of_action) AS type_of_action BY host 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in this way for every host you have the first and the last event for each host.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 15:59:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-into-a-new-field/m-p/409362#M118093</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-07-29T15:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple events into a new field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-into-a-new-field/m-p/409363#M118094</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;You should always specify and index&amp;gt; AND sourcetype=&amp;lt;And sourcetype too&amp;gt;
(EventCode="1102" OR EventCode="1100" OR EventCode="104") OR
(EventCode="1074" OR EventCode="6006" OR EventCode="6008" OR EventCode="6005" OR EventCode="6009" OR EventCode="1076")
| reverse
| streamstats count(eval(EventCode="1102" OR EventCode="1100" OR EventCode="104")) AS sessionID BY host
| stats list(_raw) AS Events values(EventCode) AS EventCodes count(eval(EventCode="1074" OR EventCode="6006" OR EventCode="6008" OR EventCode="6005" OR EventCode="6009" OR EventCode="1076")) AS shutdowns
BY sessionID host
| search  shutdowns=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jul 2019 04:58:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-multiple-events-into-a-new-field/m-p/409363#M118094</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-30T04:58:58Z</dc:date>
    </item>
  </channel>
</rss>

