<?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 How to create a search where two values of a field should not overlap with time? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-where-two-values-of-a-field-should-not/m-p/443474#M172411</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;So I have data like these:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;**_time, id, event**
2019-03-18 15:00:00.0, someone1, checkedin
2019-03-18 16:00:00.0, someone1, X
2019-03-18 16:15:00.0, someone1, checkedout
2019-03-18 17:00:00.0, someone1, checkedin
2019-03-18 17:15:00.0, someone1, checkedout
2019-03-18 15:30:00.0, someone2, checkedin
2019-03-18 16:30:00.0, someone2, checkedout
***2019-03-18 15:00:00.0, someone3, checkedin
2019-03-18 15:30:00.0, someone3, checkedin
2019-03-18 16:15:00.0, someone3, checkedout
2019-03-18 16:30:00.0, someone3, checkedout***
2019-03-18 15:30:00.0, someone4, checkedin
2019-03-18 15:45:00.0, someone4, X
2019-03-18 16:15:00.0, someone4, checkedout
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I do not care about the lines with the event is different than "checkedin" or "checkedout" ("X" here).&lt;/P&gt;

&lt;P&gt;I want to be able to detect when a person checked-in twice or more with the same id before checking out (look at bold and italic lines). And I want to return all lines or, at least id, where this is the case. I want to seperate my results per id.&lt;/P&gt;

&lt;P&gt;As I wanted to group per id but I also make a disctinction per event, my first codes were:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(event="checkedin" OR event="checkedout") | timechart span=15m count(id) by event
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(event="checkedin" OR event="checkedout") | timechart span=15m count(event) by id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But they clearly do not give me what I want.&lt;/P&gt;

&lt;P&gt;I also thought about multiple searches but as you cannot put streaming functions, it is not working.&lt;/P&gt;

&lt;P&gt;Do you have an idea how to do it please? &lt;/P&gt;</description>
    <pubDate>Mon, 18 Mar 2019 14:30:19 GMT</pubDate>
    <dc:creator>acathignol</dc:creator>
    <dc:date>2019-03-18T14:30:19Z</dc:date>
    <item>
      <title>How to create a search where two values of a field should not overlap with time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-where-two-values-of-a-field-should-not/m-p/443474#M172411</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;So I have data like these:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;**_time, id, event**
2019-03-18 15:00:00.0, someone1, checkedin
2019-03-18 16:00:00.0, someone1, X
2019-03-18 16:15:00.0, someone1, checkedout
2019-03-18 17:00:00.0, someone1, checkedin
2019-03-18 17:15:00.0, someone1, checkedout
2019-03-18 15:30:00.0, someone2, checkedin
2019-03-18 16:30:00.0, someone2, checkedout
***2019-03-18 15:00:00.0, someone3, checkedin
2019-03-18 15:30:00.0, someone3, checkedin
2019-03-18 16:15:00.0, someone3, checkedout
2019-03-18 16:30:00.0, someone3, checkedout***
2019-03-18 15:30:00.0, someone4, checkedin
2019-03-18 15:45:00.0, someone4, X
2019-03-18 16:15:00.0, someone4, checkedout
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I do not care about the lines with the event is different than "checkedin" or "checkedout" ("X" here).&lt;/P&gt;

&lt;P&gt;I want to be able to detect when a person checked-in twice or more with the same id before checking out (look at bold and italic lines). And I want to return all lines or, at least id, where this is the case. I want to seperate my results per id.&lt;/P&gt;

&lt;P&gt;As I wanted to group per id but I also make a disctinction per event, my first codes were:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(event="checkedin" OR event="checkedout") | timechart span=15m count(id) by event
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(event="checkedin" OR event="checkedout") | timechart span=15m count(event) by id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But they clearly do not give me what I want.&lt;/P&gt;

&lt;P&gt;I also thought about multiple searches but as you cannot put streaming functions, it is not working.&lt;/P&gt;

&lt;P&gt;Do you have an idea how to do it please? &lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2019 14:30:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-where-two-values-of-a-field-should-not/m-p/443474#M172411</guid>
      <dc:creator>acathignol</dc:creator>
      <dc:date>2019-03-18T14:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search where two values of a field should not overlap with time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-where-two-values-of-a-field-should-not/m-p/443475#M172412</link>
      <description>&lt;P&gt;@acathignol you can try something like this, it will give you login and logout counts in a 15 minute time span per id.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;your query&amp;gt;| bin span=15min _time|stats count(eval(event="checkedin")) as checkedin, count(eval(event="checkedout")) as checkedout by id _time| where checkedin &amp;gt; checkedout
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Mar 2019 19:47:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-where-two-values-of-a-field-should-not/m-p/443475#M172412</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2019-03-18T19:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search where two values of a field should not overlap with time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-where-two-values-of-a-field-should-not/m-p/443476#M172413</link>
      <description>&lt;P&gt;Thank you for your answer. At the end, I would like to see if 2 persons are actually using the same pass, which I can see if they are checking in without the other checking out first. &lt;/P&gt;

&lt;P&gt;The code you have written gave me the lines in italic and bold. The thing is that there is no disctinction between people using the same pass or poeple using a pass, checking out and then checking in again.&lt;BR /&gt;
&lt;STRONG&gt;_time, id, checkedin, checkedout&lt;/STRONG&gt;&lt;BR /&gt;
&lt;STRONG&gt;&lt;EM&gt;2019-03-18 15:00:00.0, someone1, 1, 0&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
2019-03-18 16:15:00.0, someone1, 0, 1&lt;BR /&gt;
2019-03-18 17:00:00.0, someone1, 1, 1&lt;BR /&gt;
&lt;STRONG&gt;&lt;EM&gt;2019-03-18 15:30:00.0, someone2, 1, 0&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
2019-03-18 16:30:00.0, someone2, 0, 1&lt;BR /&gt;
&lt;STRONG&gt;&lt;EM&gt;2019-03-18 15:00:00.0, someone3, 1, 0&lt;BR /&gt;
2019-03-18 15:30:00.0, someone3, 1, 0&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
2019-03-18 16:15:00.0, someone3, 0, 2&lt;BR /&gt;
&lt;STRONG&gt;&lt;EM&gt;2019-03-18 15:30:00.0, someone4, 1, 0&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
2019-03-18 16:15:00.0, someone4, 0, 1&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2019 10:26:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-where-two-values-of-a-field-should-not/m-p/443476#M172413</guid>
      <dc:creator>acathignol</dc:creator>
      <dc:date>2019-03-19T10:26:52Z</dc:date>
    </item>
  </channel>
</rss>

