<?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: Using untable function and perform the join with two fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-untable-function-and-perform-the-join-with-two-fields/m-p/498703#M138933</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;|tstats count as totalCount where index=foo earliest=-14d by _time span=1d source
| append [ search index=foo source="A" earliest=-14d
| bin _time span=1d
| fields - index - splunk_server - punct - linecount - splunk_server_group - tag - tag::eventtype - unix_category - unix_group - _raw - eventtype - host - source - sourcetype
| table *
| untable _time FieldName FieldValue
| stats count as Event_count, dc(FieldValue) as distinctCount, mean(FieldValue) as mean by _time FieldName
| eval source="A" ]
| append [ search index=foo source="B" earliest=-14d
...
| eval source="E"]
| selfjoin _time source
| sort - _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You'll have to count them one by one.&lt;/P&gt;</description>
    <pubDate>Wed, 13 May 2020 19:11:23 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-05-13T19:11:23Z</dc:date>
    <item>
      <title>Using untable function and perform the join with two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-untable-function-and-perform-the-join-with-two-fields/m-p/498702#M138932</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;

&lt;P&gt;I need help with two questions. Please consider below scenario:&lt;/P&gt;

&lt;P&gt;index=foo source="A" OR source="B" OR source="C" OR source="D" OR source="E" OR source="F" OR source="G" OR source="H" OR source="I" earliest=-14d &lt;BR /&gt;
| bin _time span=1d &lt;BR /&gt;
| fields  - index - splunk_server - punct - linecount  - splunk_server_group - tag - tag::eventtype - unix_category - unix_group - _raw   - eventtype - host - source - sourcetype&lt;BR /&gt;
| table *&lt;BR /&gt;
| untable _time FieldName FieldValue&lt;BR /&gt;
| stats count as Event_count, dc(FieldValue) as distinctCount, mean(FieldValue) as mean  by _time FieldName&lt;BR /&gt;
| sort - _time&lt;/P&gt;

&lt;P&gt;The output of above search is table as below&lt;BR /&gt;
_time                         FieldName                   Event_count           distinctCount                         mean&lt;BR /&gt;
05/13/2020                     Field1                                     520                             520&lt;BR /&gt;&lt;BR /&gt;
05/13/2020                     Field2                                      77                                      56&lt;BR /&gt;&lt;BR /&gt;
05/13/2020                     Field3                                    1183                           1177                                   450&lt;BR /&gt;
05/13/2020                     Field4                                    1785                          1785                  3164.5299719887953&lt;/P&gt;

&lt;P&gt;I have similar values for last 14 days and these field values in the FieldName column are coming from various sources as mentioned in the search. Now, is it possible to add the respective source column for each of those field values? &lt;BR /&gt;
Here some fields are coming from multiple sources so is it possible to divide the count values based on the source it is coming from? (For instance - Field 1 could be coming from source E and F with counts 260 from E and 260 from F)&lt;/P&gt;

&lt;P&gt;I have another search as below:&lt;/P&gt;

&lt;P&gt;index=foo source=* earliest=-14d &lt;BR /&gt;
    | bin _time span=1d &lt;BR /&gt;
    | stats count as totalCount by _time source&lt;BR /&gt;
    | sort - _time &lt;/P&gt;

&lt;P&gt;The output of above search is table as below&lt;/P&gt;

&lt;P&gt;_time                 source  totalCount&lt;BR /&gt;
2020-05-13            A         283&lt;BR /&gt;
2020-05-13            B        1785&lt;BR /&gt;
2020-05-13            C         252&lt;BR /&gt;
2020-05-13            D         507&lt;BR /&gt;
2020-05-13            E            336&lt;BR /&gt;
2020-05-13            F          10527&lt;BR /&gt;
2020-05-13            G          1183&lt;BR /&gt;
2020-05-13            H          2586&lt;/P&gt;

&lt;P&gt;Now, my another question is that I would like to join both of these tables using the columns _time and source to get count of the source from 2nd table to be added in the first table for each field values based on the source it is coming from.&lt;/P&gt;

&lt;P&gt;Any help would be appreciated!!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:26:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-untable-function-and-perform-the-join-with-two-fields/m-p/498702#M138932</guid>
      <dc:creator>khojas02</dc:creator>
      <dc:date>2020-09-30T05:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using untable function and perform the join with two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-untable-function-and-perform-the-join-with-two-fields/m-p/498703#M138933</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;|tstats count as totalCount where index=foo earliest=-14d by _time span=1d source
| append [ search index=foo source="A" earliest=-14d
| bin _time span=1d
| fields - index - splunk_server - punct - linecount - splunk_server_group - tag - tag::eventtype - unix_category - unix_group - _raw - eventtype - host - source - sourcetype
| table *
| untable _time FieldName FieldValue
| stats count as Event_count, dc(FieldValue) as distinctCount, mean(FieldValue) as mean by _time FieldName
| eval source="A" ]
| append [ search index=foo source="B" earliest=-14d
...
| eval source="E"]
| selfjoin _time source
| sort - _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You'll have to count them one by one.&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 19:11:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-untable-function-and-perform-the-join-with-two-fields/m-p/498703#M138933</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-13T19:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using untable function and perform the join with two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-untable-function-and-perform-the-join-with-two-fields/m-p/498704#M138934</link>
      <description>&lt;P&gt;This has worked for me. Thank you for your help!!&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 01:01:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-untable-function-and-perform-the-join-with-two-fields/m-p/498704#M138934</guid>
      <dc:creator>khojas02</dc:creator>
      <dc:date>2020-05-14T01:01:03Z</dc:date>
    </item>
  </channel>
</rss>

