<?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 perform a search with multiple files and combine the results in a single table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471719#M132715</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{\"A_NAME\":\"aaa\",\"dept\":[{\"D_NAME\":\"D1\",\"PROJECT\":[{\"PROJECT_NAME\":\"P1\"}]}]}
{\"JOB_NUM\":\"1\",\"JOB_TIME\":\"1/1/2020\",\"JOB_STATUS\":\"PASS\",\"JOB_DURATION\":\"304\"}
{\"TASK_NUM\":\"1\",\"TASK_TIME\":\"10/2/2020\",\"TASK_STATUS\":\"FAIL\",\"TASK_DURATION\":\"239\"}"
| eval _raw=replace(_raw,"(?m)^\s?{","#{")
| eval _raw=split(_raw,"#")
| stats count by _raw
`comment("this is your sample, from here, the logic")`
| spath
| stats values(*) as *
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 13 Feb 2020 12:06:34 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-02-13T12:06:34Z</dc:date>
    <item>
      <title>how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471715#M132711</link>
      <description>&lt;P&gt;Hello all,&lt;BR /&gt;
I have a requirement where i want to get data from multiple files which has different indexes and combine the results into a single table. I tried using all possible ways using appendcols , nested search etc. can anyone please help me in doing this?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 10:16:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471715#M132711</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2020-02-13T10:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471716#M132712</link>
      <description>&lt;P&gt;Hi @anooshac,&lt;BR /&gt;
could you share more infos?&lt;BR /&gt;
there are common fields?&lt;BR /&gt;
can you describe two or three of these searches to combine?&lt;/P&gt;

&lt;P&gt;There are some ways to combine more searches in one table, but you have to define which is the table structure, in other words what do you have on X and Y axes?&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 11:04:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471716#M132712</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-02-13T11:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471717#M132713</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt; , thanks for the response. I have 3 json files. The names of the PROJECT is in 1.json and the details of PROJECT will be in P1_job.json and P1_task.json.&lt;/P&gt;

&lt;P&gt;1.json&lt;BR /&gt;
{&lt;BR /&gt;
        "A_NAME" : "aaa",&lt;BR /&gt;
        "dept" : [{&lt;BR /&gt;
            "D_NAME" : "D1",&lt;BR /&gt;
            "PROJECT" : [{&lt;BR /&gt;
                "PROJECT_NAME" : "P1"&lt;BR /&gt;
            }]&lt;BR /&gt;
    }]&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;P1_job.json&lt;BR /&gt;
 {&lt;BR /&gt;
  "JOB_NUM" : "1",&lt;BR /&gt;
  "JOB_TIME" : "1/1/2020",&lt;BR /&gt;
  "JOB_STATUS" : "PASS",&lt;BR /&gt;
  "JOB_DURATION" : "304"&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;P1_task.json&lt;BR /&gt;
 {&lt;BR /&gt;
  "TASK_NUM" : "1",&lt;BR /&gt;
  "TASK_TIME" : "10/2/2020",&lt;BR /&gt;
  "TASK_STATUS" : "FAIL",&lt;BR /&gt;
  "TASK_DURATION" : "239"&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;I want a table  consisting of &lt;BR /&gt;
A_NAME,D_NAME,PROJECT_NAME,JOB_NUM,JOB_TIME,JOB_STATUS,TASK_NUM,TASK_TIME,TASK_STATUS&lt;BR /&gt;
(There are a lot more data in json file but here i posted a small part of it ).&lt;BR /&gt;
I have tried using subsearch i couldn't able to get the proper result. Can you please help me in this!!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:11:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471717#M132713</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2020-09-30T04:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471718#M132714</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/30057"&gt;@anooshac&lt;/a&gt;,&lt;BR /&gt;
what's the key to correlate P1, P1_job and P1_task?&lt;BR /&gt;
in other words, what's the common field?&lt;BR /&gt;
is it maybe the file name?&lt;BR /&gt;
if it's the file name, please share some examples of file names.&lt;/P&gt;

&lt;P&gt;Anyway, you should extract the key from file names (using regexes) and use it to correlate the three data types and use stats:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index
| rex field=source "^(?&amp;lt;key1&amp;gt;[^\._]*)\.json"
| rex field=source "^(?&amp;lt;key2&amp;gt;[^_]*)_job\.json"
| rex field=source "^(?&amp;lt;key3&amp;gt;[^_]*)_task\.json"
| eval key=coalesce(key1,key2,key3)
| stats values(A_NAME) AS A_NAME values(D_NAME) AS D_NAME values(PROJECT_NAME) AS PROJECT_NAME values(JOB_NUM) AS JOB_NUM values(JOB_TIME9 AS JOB_TIME values(JOB_STATUS) AS JOB_STATUS values(TASK_NUM) AS TASK_NUM values(TASK_TIME) AS TASK_TIME values(TASK_STATUS) AS TASK_STATUS BY key
| fields - key
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:11:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471718#M132714</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-30T04:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471719#M132715</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{\"A_NAME\":\"aaa\",\"dept\":[{\"D_NAME\":\"D1\",\"PROJECT\":[{\"PROJECT_NAME\":\"P1\"}]}]}
{\"JOB_NUM\":\"1\",\"JOB_TIME\":\"1/1/2020\",\"JOB_STATUS\":\"PASS\",\"JOB_DURATION\":\"304\"}
{\"TASK_NUM\":\"1\",\"TASK_TIME\":\"10/2/2020\",\"TASK_STATUS\":\"FAIL\",\"TASK_DURATION\":\"239\"}"
| eval _raw=replace(_raw,"(?m)^\s?{","#{")
| eval _raw=split(_raw,"#")
| stats count by _raw
`comment("this is your sample, from here, the logic")`
| spath
| stats values(*) as *
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Feb 2020 12:06:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471719#M132715</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-13T12:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471720#M132716</link>
      <description>&lt;P&gt;Thank you for the answer i'll try it out and let you know.The main file is not P1.json it's 1.json and P1 is a project name which is a field of that file.&lt;BR /&gt;
The only term common to all the files is the name of project in the file name that is in this example "P1". &lt;BR /&gt;
The files are 1.json,P1_job.json,P1_task.json&lt;BR /&gt;
The project names are in 1.json, which are being used in the file names of other two.&lt;BR /&gt;
Is there any way that i can do sub search ?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:12:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471720#M132716</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2020-09-30T04:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471721#M132717</link>
      <description>&lt;P&gt;hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/184221"&gt;@to4kawa&lt;/a&gt; , thanks for the response.&lt;BR /&gt;
I tried this and i'm only getting ,&lt;BR /&gt;
A_NAME     dept{}.D_NAME    dept{}.PROJECT{}.PROJECT_NAME&lt;BR /&gt;
these fields in the table. Why is that so?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:12:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471721#M132717</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2020-09-30T04:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471722#M132718</link>
      <description>&lt;P&gt;Assuming three files in three different indexes. Replace &lt;STRONG&gt;index&lt;/STRONG&gt; names in below search query and try: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = index_PROJECT | eval PROJECT_NAME = dept{}.PROJECT{}.PROJECT_NAME, D_NAME =  dept{}.D_NAME | join type=left PROJECT_NAME [search index = index_job | rex field = source "/*(?&amp;lt;PROJECT_NAME&amp;gt;[a-zA-Z0-9]+)\w*.json" | join type=left PROJECT_NAME [search index = index_task | rex field = source "/*(?&amp;lt;PROJECT_NAME&amp;gt;[a-zA-Z0-9]+)\w*.json" ] ] | table A_NAME, D_NAME, PROJECT_NAME, JOB_NUM, JOB_TIME, JOB_STATUS, TASK_NUM, TASK_TIME, TASK_STATUS
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Feb 2020 05:31:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471722#M132718</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-02-14T05:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471723#M132719</link>
      <description>&lt;P&gt;thanks @manjunathmeti for the response! i'll try this and let you know.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 06:12:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471723#M132719</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2020-02-14T06:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471724#M132720</link>
      <description>&lt;P&gt;Hi the 3 files are 1.json, P1_job.json, P1_task.json. The file 1.json has project name as a field and the other 2 files has project name in their file name. Is there a way that i can achieve this by using sub search?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:12:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471724#M132720</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2020-09-30T04:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471725#M132721</link>
      <description>&lt;P&gt;Hi @anooshac,&lt;BR /&gt;
as I said, you have to find a common key, if the project name is a field of first flow and in the name for second and this flow, use it to correlate the three flows, in other words, you can use my search without the first regex becaus it's already a field and you don't need to extract.&lt;/P&gt;

&lt;P&gt;You cannot use a subsearch because, as I said, you need a common key for correlation.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 11:09:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471725#M132721</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-02-14T11:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471726#M132722</link>
      <description>&lt;P&gt;hi, @annoshac&lt;BR /&gt;
&lt;CODE&gt;code sample&lt;/CODE&gt; makes extra space &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;
my answer is updated.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Feb 2020 00:34:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471726#M132722</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-15T00:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471727#M132723</link>
      <description>&lt;P&gt;thank you for the answer, i'll try that and let you know.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2020 11:49:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471727#M132723</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2020-02-17T11:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471728#M132724</link>
      <description>&lt;P&gt;Still i'm getting only 3 fields in my result.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 05:28:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471728#M132724</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2020-02-18T05:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to perform a search with multiple files and combine the results in a single table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471729#M132725</link>
      <description>&lt;P&gt;This is sample.&lt;BR /&gt;
try &lt;CODE&gt;spath&lt;/CODE&gt; with your query.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 09:26:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-perform-a-search-with-multiple-files-and-combine-the/m-p/471729#M132725</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-18T09:26:49Z</dc:date>
    </item>
  </channel>
</rss>

