<?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: Transaction based Alert Trigger with multiple conditions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Transaction-based-Alert-Trigger-with-multiple-conditions/m-p/299578#M90263</link>
    <description>&lt;P&gt;Hi  mfritsch,&lt;BR /&gt;
I don't see in index2 (LightSensors) the room where the light is positioned so I can image that this is an example and that i can extrapolate the room number from the LightID field number (e.g. light1 is in room1) .&lt;BR /&gt;
So you could run something like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=LightSensors State="On" 
| rex field=LightSensor "Light(?&amp;lt;LightRoom&amp;gt;\d+)"
| eval DoorID="Door"+LightRoom
| search [ search index=DoorSensors | stats values(State) AS DoorState BY DoorID | search State="Open" State="Close" | fields DoorID]
| table _time DoorID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if you could have the room number in index 2 the search is easier:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=LightSensors State="On" [ search index=DoorSensors | stats values(State) AS DoorState BY DoorID | search State="Open" State="Close" | fields DoorID]
| table _time DoorID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To manage the presence of more doors or more lights for each room you have only to find the rule to extrapolate the room number.&lt;/P&gt;

&lt;P&gt;You could also use transaction command in the subsearch but this solution is more performant.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Sat, 07 Oct 2017 07:52:28 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2017-10-07T07:52:28Z</dc:date>
    <item>
      <title>Transaction based Alert Trigger with multiple conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-based-Alert-Trigger-with-multiple-conditions/m-p/299577#M90262</link>
      <description>&lt;P&gt;I like to create a trigger which fires based multiple conditions&lt;/P&gt;

&lt;P&gt;Example Scenario:&lt;BR /&gt;
A per person is entering a room and the door sensor sends an open event to splunk.&lt;BR /&gt;
Next the person switch on the light. The light sensor send the "on" event to splunk.&lt;BR /&gt;
The person leaves the room without switch the light off. A door close event is send to splunk.&lt;BR /&gt;
Result the person forget to switch of the light. I like to detect this.&lt;/P&gt;

&lt;P&gt;I have two indexs &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Index 1: DoorSensors
Timestamp, DoorID, State
2017-10-06 12:01:30, Door1, Open
2017-10-06 12:03:50, Door1, Close

Index 2: LightSensors
Timestamp, LightSensor, State
2017-10-06 12:01:35, Light1, On
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How to detected by a alert trigger that someone forgot to turn off the light?&lt;BR /&gt;
I like to run this in real-time.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 14:55:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-based-Alert-Trigger-with-multiple-conditions/m-p/299577#M90262</guid>
      <dc:creator>mfritsch</dc:creator>
      <dc:date>2017-10-06T14:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction based Alert Trigger with multiple conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-based-Alert-Trigger-with-multiple-conditions/m-p/299578#M90263</link>
      <description>&lt;P&gt;Hi  mfritsch,&lt;BR /&gt;
I don't see in index2 (LightSensors) the room where the light is positioned so I can image that this is an example and that i can extrapolate the room number from the LightID field number (e.g. light1 is in room1) .&lt;BR /&gt;
So you could run something like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=LightSensors State="On" 
| rex field=LightSensor "Light(?&amp;lt;LightRoom&amp;gt;\d+)"
| eval DoorID="Door"+LightRoom
| search [ search index=DoorSensors | stats values(State) AS DoorState BY DoorID | search State="Open" State="Close" | fields DoorID]
| table _time DoorID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if you could have the room number in index 2 the search is easier:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=LightSensors State="On" [ search index=DoorSensors | stats values(State) AS DoorState BY DoorID | search State="Open" State="Close" | fields DoorID]
| table _time DoorID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To manage the presence of more doors or more lights for each room you have only to find the rule to extrapolate the room number.&lt;/P&gt;

&lt;P&gt;You could also use transaction command in the subsearch but this solution is more performant.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 07 Oct 2017 07:52:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-based-Alert-Trigger-with-multiple-conditions/m-p/299578#M90263</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-07T07:52:28Z</dc:date>
    </item>
  </channel>
</rss>

