<?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: How to edit my search to combine multiple rows into one output row in my results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280832#M84762</link>
    <description>&lt;P&gt;Is there any advantage to using the if instead of the case?  Or is it just a matter of personal preference?&lt;/P&gt;</description>
    <pubDate>Tue, 25 Oct 2016 22:02:25 GMT</pubDate>
    <dc:creator>szimmer661</dc:creator>
    <dc:date>2016-10-25T22:02:25Z</dc:date>
    <item>
      <title>How to edit my search to combine multiple rows into one output row in my results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280826#M84756</link>
      <description>&lt;P&gt;I am taking numerous log entries and trying to produce an output report that shows the earliest logon time and the latest logoff or disconnect time by day and user.  I've got the earliest logon time and latest logoff or disconnect time part working, but the output comes out as a row per event type.  I've seen answers suggesting the use of stats or chart to display the results, but when I try that, I get one row for each date and userid combination, but no times are shown.&lt;/P&gt;

&lt;P&gt;Any help is greatly appreciated.  My search is below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = ironstream (MSGNUM=IEF125I OR MSGNUM=IEF126I OR MSGNUM=IEF450I) JOBID=TSU* | rename JOBNAME as UserID |  eval EventDate=strftime(_time,"%Y%m%d") | eval EventTime=strftime(_time,"%H:%M:%S") | stats earliest(EventTime) as start latest(EventTime) as end by UserID EventDate MSGNUM | eval LogonTime=case(MSGNUM="IEF125I",start) | eval LogoffTime=case(MSGNUM="IEF126I",end) | eval DisconnectTime=case(MSGNUM="IEF450I",end) | lookup TAM_Information.csv UserID OUTPUT FULNAME as Name AD_DEPARTMENT as Department | table EventDate UserID Name Department LogonTime LogoffTime DisconnectTime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Oct 2016 21:21:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280826#M84756</guid>
      <dc:creator>szimmer661</dc:creator>
      <dc:date>2016-10-25T21:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to combine multiple rows into one output row in my results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280827#M84757</link>
      <description>&lt;P&gt;See if this is what you're looking for&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = ironstream (MSGNUM=IEF125I OR MSGNUM=IEF126I OR MSGNUM=IEF450I) JOBID=TSU* 
| rename JOBNAME as UserID 
| eval EventDate=strftime(_time,"%Y%m%d") 
| eval EventTime=strftime(_time,"%H:%M:%S") 
| stats earliest(EventTime) as start latest(EventTime) as end by UserID EventDate MSGNUM 
| eval LogonTime=case(MSGNUM="IEF125I",start) 
| eval LogoffTime=case(MSGNUM="IEF126I",end) 
| eval DisconnectTime=case(MSGNUM="IEF450I",end) 
| lookup TAM_Information.csv UserID OUTPUT FULNAME as Name AD_DEPARTMENT as Department 
| table EventDate UserID Name Department LogonTime LogoffTime DisconnectTime
| stats values(*) as * by UserID EventDate
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Oct 2016 21:27:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280827#M84757</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-25T21:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to combine multiple rows into one output row in my results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280828#M84758</link>
      <description>&lt;P&gt;Try this&lt;BR /&gt;
&lt;STRONG&gt;Updated&lt;/STRONG&gt; Was supposed to use &lt;CODE&gt;if&lt;/CODE&gt; instead of &lt;CODE&gt;case&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = ironstream (MSGNUM=IEF125I OR MSGNUM=IEF126I OR MSGNUM=IEF450I) JOBID=TSU* 
| rename JOBNAME as UserID | eval EventDate=strftime(_time,"%Y%m%d") 
| eval LogonTime=if(MSGNUM="IEF125I",strftime(_time,"%H:%M:%S"),null()) 
| eval LogoffTime=if(MSGNUM="IEF126I",strftime(_time,"%H:%M:%S"),null()) 
| eval DisconnectTime=case(MSGNUM="IEF450I",strftime(_time,"%H:%M:%S"),null())
| stats earliest(LogonTime) as LogonTime latest(LogoffTime) as LogoffTime latest(DisconnectTime) as DisconnectTime by UserID EventDate 
 | lookup TAM_Information.csv UserID OUTPUT FULNAME as Name AD_DEPARTMENT as Department | table EventDate UserID Name Department LogonTime LogoffTime DisconnectTime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Oct 2016 21:30:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280828#M84758</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-25T21:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to combine multiple rows into one output row in my results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280829#M84759</link>
      <description>&lt;P&gt;This worked, but the result totally ignored the column order specified in the table clause.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 21:41:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280829#M84759</guid>
      <dc:creator>szimmer661</dc:creator>
      <dc:date>2016-10-25T21:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to combine multiple rows into one output row in my results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280830#M84760</link>
      <description>&lt;P&gt;This worked very nicely.  Splunk didn't like the null() argument in the case expressions, but once I removed those, the results were exactly as desired.&lt;/P&gt;

&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 21:43:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280830#M84760</guid>
      <dc:creator>szimmer661</dc:creator>
      <dc:date>2016-10-25T21:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to combine multiple rows into one output row in my results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280831#M84761</link>
      <description>&lt;P&gt;I meant to change &lt;CODE&gt;case&lt;/CODE&gt; to &lt;CODE&gt;if&lt;/CODE&gt;, but forgot (if is the one which uses three parameter). &lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 21:44:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280831#M84761</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-25T21:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to combine multiple rows into one output row in my results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280832#M84762</link>
      <description>&lt;P&gt;Is there any advantage to using the if instead of the case?  Or is it just a matter of personal preference?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 22:02:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-combine-multiple-rows-into-one-output/m-p/280832#M84762</guid>
      <dc:creator>szimmer661</dc:creator>
      <dc:date>2016-10-25T22:02:25Z</dc:date>
    </item>
  </channel>
</rss>

