<?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: Two row details into one row in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111392#M29186</link>
    <description>&lt;P&gt;Is login an &lt;CODE&gt;extracted&lt;/CODE&gt; field? You can't make a transaction on a field that does not exist. Why is &lt;CODE&gt;userid&lt;/CODE&gt; extracted twice? Also, there is no point in &lt;CODE&gt;sort&lt;/CODE&gt;ing before the &lt;CODE&gt;transaction&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;I believe that you want to do something like;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=summa 
| rex "^\S+\s(?&amp;lt;userid&amp;gt;\S+)\." 
| transaction userid startswith="Logged in" endswith="Processing complete"
| eval logoutTime = strftime( _time + duration,"%F %T")
| eval loginTime =strftime( _time, "%F %T")
| stats list(loginTime) as Login list(logoutTime) as Logout count as "Number of Sessions" by userid
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;alternatively, the last line can be substituted with;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table userid, loginTime, logoutTime, duration
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It's a bit unclear if you want to do it the first or the second way.&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
    <pubDate>Wed, 23 Oct 2013 17:11:13 GMT</pubDate>
    <dc:creator>kristian_kolb</dc:creator>
    <dc:date>2013-10-23T17:11:13Z</dc:date>
    <item>
      <title>Two row details into one row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111390#M29184</link>
      <description>&lt;P&gt;I have the below search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=summa 
| rex "::\s(?&amp;lt;timestamp&amp;gt;\S+)\s"
| rex "^\S+\s(?&amp;lt;userid&amp;gt;\S+)\." 
| sort userid timestamp 
|transaction login startswith="Logged in" endswith="Processing complete" 
| rex "^\S+\s(?&amp;lt;userid&amp;gt;\S+)\." 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which provide the rsultlinke Table-1, I want fix few things in T-1.&lt;BR /&gt;
  1. The reuslt should display some thing like this now this details are spread in two rows one after the other.&lt;BR /&gt;
    USER-id, Login time, log out time, number of login sessaion&lt;/P&gt;

&lt;P&gt;Thanks &lt;BR /&gt;
Rajan&lt;/P&gt;

&lt;P&gt;Table-1&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;4/3/13 11:46:12.000 AM &lt;BR /&gt;
SNM4 rajan.#### :: 04/03/13 11:46:12 :: User rajan logged in&lt;BR /&gt;
SNM4 rajan.857F :: 04/03/13 11:46:13 :: Processing complete&lt;BR /&gt;
host=hostname   Options|  sourcetype=summa   Options|  source=C:\Data\splunk\fxr\snm4-logger.log   Options&lt;BR /&gt;
4/3/13 11:46:08.000 AM  &lt;BR /&gt;
SNM4 verify.#### :: 04/03/13 11:46:08 :: User verify logged in&lt;BR /&gt;
SNM4 different.855F :: 04/03/13 11:46:12 :: Processing complete&lt;BR /&gt;
4/3/13 11:45:58.000 AM  &lt;BR /&gt;
SNM4 suman.#### :: 04/03/13 11:45:58 :: User suman logged in&lt;BR /&gt;
SNM4 suman.853F :: 04/03/13 11:45:59 :: Processing complete&lt;BR /&gt;
host=hostname   Options|  sourcetype=summa   Options|  source=C:\Data\splunk\fxr\snm4-logger.log   Options&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2013 10:58:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111390#M29184</guid>
      <dc:creator>srajanbabu</dc:creator>
      <dc:date>2013-10-23T10:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Two row details into one row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111391#M29185</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=summa 
| rex "^\S+\s(?&amp;lt;userid&amp;gt;\S+)\." 
| sort userid _time 
| transaction login startswith="Logged in" endswith="Processing complete" 
| eval logoutTime = strftime( _time + duration,"%x %X")
| eval loginTime =strftime( _time, "%x %X")
| table userId loginTime logoutTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't know how you want to show both the individual sessions and the overall count. To calculate the count, you could simply do&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=summa 
| rex "^\S+\s(?&amp;lt;userid&amp;gt;\S+)\." 
| sort userid _time 
| transaction login startswith="Logged in" endswith="Processing complete" 
| stats count by userid
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Oct 2013 16:03:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111391#M29185</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-10-23T16:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Two row details into one row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111392#M29186</link>
      <description>&lt;P&gt;Is login an &lt;CODE&gt;extracted&lt;/CODE&gt; field? You can't make a transaction on a field that does not exist. Why is &lt;CODE&gt;userid&lt;/CODE&gt; extracted twice? Also, there is no point in &lt;CODE&gt;sort&lt;/CODE&gt;ing before the &lt;CODE&gt;transaction&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;I believe that you want to do something like;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=summa 
| rex "^\S+\s(?&amp;lt;userid&amp;gt;\S+)\." 
| transaction userid startswith="Logged in" endswith="Processing complete"
| eval logoutTime = strftime( _time + duration,"%F %T")
| eval loginTime =strftime( _time, "%F %T")
| stats list(loginTime) as Login list(logoutTime) as Logout count as "Number of Sessions" by userid
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;alternatively, the last line can be substituted with;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table userid, loginTime, logoutTime, duration
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It's a bit unclear if you want to do it the first or the second way.&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2013 17:11:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111392#M29186</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-10-23T17:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: Two row details into one row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111393#M29187</link>
      <description>&lt;P&gt;Kristian,&lt;BR /&gt;
    Your rex gave me what exactly I wanted thanks a lot. Just one more query on the same item, I want to list out incomplete transation (i.e.) user who are currently loged in and not loged out. Will you able to help me.&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Rajan&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2013 07:01:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111393#M29187</guid>
      <dc:creator>srajanbabu</dc:creator>
      <dc:date>2013-10-24T07:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Two row details into one row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111394#M29188</link>
      <description>&lt;P&gt;Hi Rajan,&lt;/P&gt;

&lt;P&gt;For this requirement, do you have any 'suppression key' in these events which can identify a single session(it needs to be common in both 'Logged In' and Processing complete' event)?&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Disha&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2013 05:37:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111394#M29188</guid>
      <dc:creator>dishasaxena</dc:creator>
      <dc:date>2013-10-25T05:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Two row details into one row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111395#M29189</link>
      <description>&lt;P&gt;Kristian,&lt;BR /&gt;
 There is no suppression key associated with this even. Every  "Logged in" should have "Processing complete" for that user-id. At present if there is no "Processing complete" after logged in" after the time of this start even then, will asume the user is yet to log out.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2013 08:32:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111395#M29189</guid>
      <dc:creator>srajanbabu</dc:creator>
      <dc:date>2013-10-25T08:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Two row details into one row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111396#M29190</link>
      <description>&lt;P&gt;Thanks for taking time and answering this, the other answer worked for me.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2013 08:49:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-row-details-into-one-row/m-p/111396#M29190</guid>
      <dc:creator>srajanbabu</dc:creator>
      <dc:date>2013-10-25T08:49:26Z</dc:date>
    </item>
  </channel>
</rss>

