<?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 combine and chart data from multiple files in the same folder, but only if a certain type of file exists? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-and-chart-data-from-multiple-files-in-the-same/m-p/173384#M49710</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am new to splunk and need help with my use case below.&lt;BR /&gt;
Whenever a request is made to my application, it will create a new unique folder and start writing the information to three files called 1.err,  2.xml,  3.xml.  1.err file will be created only whenever any error is identified., otherwise this file will not be created.&lt;/P&gt;

&lt;P&gt;My 1.err file contains&lt;BR /&gt;&lt;BR /&gt;
FAIL_ERROR_MESSAGE = Error due to function: function name.&lt;/P&gt;

&lt;P&gt;If the file 1.err exists in the folder then i need to get all the FAIL_ERROR_MESSAGE count and from 2.xml file i need to get &lt;BR /&gt;
 &lt;STRONG&gt;&lt;EM&gt;SENDID&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
attribute value&lt;BR /&gt;
from that folder and from 3.xml file i need to get GFM value as shown in below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;          &amp;lt;name&amp;gt;GFM&amp;lt;/name&amp;gt;
          &amp;lt;value&amp;gt;Test&amp;lt;/value&amp;gt;
          &amp;lt;dataType&amp;gt;String&amp;lt;/dataType&amp;gt;
        &amp;lt;/attribute&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to prepare a chart where it can show error messages by &lt;STRONG&gt;SENDID&lt;/STRONG&gt; and by &lt;STRONG&gt;GFM&lt;/STRONG&gt; value. The data should be collected from all the folders where the folder contains 1.err file.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 17:57:11 GMT</pubDate>
    <dc:creator>avinashreddy539</dc:creator>
    <dc:date>2020-09-28T17:57:11Z</dc:date>
    <item>
      <title>How to combine and chart data from multiple files in the same folder, but only if a certain type of file exists?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-and-chart-data-from-multiple-files-in-the-same/m-p/173384#M49710</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am new to splunk and need help with my use case below.&lt;BR /&gt;
Whenever a request is made to my application, it will create a new unique folder and start writing the information to three files called 1.err,  2.xml,  3.xml.  1.err file will be created only whenever any error is identified., otherwise this file will not be created.&lt;/P&gt;

&lt;P&gt;My 1.err file contains&lt;BR /&gt;&lt;BR /&gt;
FAIL_ERROR_MESSAGE = Error due to function: function name.&lt;/P&gt;

&lt;P&gt;If the file 1.err exists in the folder then i need to get all the FAIL_ERROR_MESSAGE count and from 2.xml file i need to get &lt;BR /&gt;
 &lt;STRONG&gt;&lt;EM&gt;SENDID&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
attribute value&lt;BR /&gt;
from that folder and from 3.xml file i need to get GFM value as shown in below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;          &amp;lt;name&amp;gt;GFM&amp;lt;/name&amp;gt;
          &amp;lt;value&amp;gt;Test&amp;lt;/value&amp;gt;
          &amp;lt;dataType&amp;gt;String&amp;lt;/dataType&amp;gt;
        &amp;lt;/attribute&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to prepare a chart where it can show error messages by &lt;STRONG&gt;SENDID&lt;/STRONG&gt; and by &lt;STRONG&gt;GFM&lt;/STRONG&gt; value. The data should be collected from all the folders where the folder contains 1.err file.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:57:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-and-chart-data-from-multiple-files-in-the-same/m-p/173384#M49710</guid>
      <dc:creator>avinashreddy539</dc:creator>
      <dc:date>2020-09-28T17:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine and chart data from multiple files in the same folder, but only if a certain type of file exists?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-and-chart-data-from-multiple-files-in-the-same/m-p/173385#M49711</link>
      <description>&lt;P&gt;This is an interesting use case. I'm not aware of any way to tell splunk only to index the files if it sees a .err file. You can index all of them, then alert based on the presence of the error message. &lt;/P&gt;

&lt;P&gt;You would need some kind of transaction ID that is shared between the 2 xml &amp;amp; 1 err file in order to get the specifics you need. Perhaps the unique directory name could be used as that transaction ID. You would then use the xmlkv command to extract the SENDID and GFM values extracted into your report also.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2014 14:51:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-and-chart-data-from-multiple-files-in-the-same/m-p/173385#M49711</guid>
      <dc:creator>jeremiahc4</dc:creator>
      <dc:date>2014-10-21T14:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine and chart data from multiple files in the same folder, but only if a certain type of file exists?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-and-chart-data-from-multiple-files-in-the-same/m-p/173386#M49712</link>
      <description>&lt;P&gt;we can index all files. But while generating the report we are interested in only .err files. if we have .err file in folder then only we need to fetch the fields from other files in same folder.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2014 18:32:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-and-chart-data-from-multiple-files-in-the-same/m-p/173386#M49712</guid>
      <dc:creator>avinashreddy539</dc:creator>
      <dc:date>2014-10-21T18:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine and chart data from multiple files in the same folder, but only if a certain type of file exists?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-and-chart-data-from-multiple-files-in-the-same/m-p/173387#M49713</link>
      <description>&lt;P&gt;I'd say you'd want to setup your inputs.conf on the server where you are getting these .err files such that you index all the files using a regex "*" in place of the unique directory. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///path/to/files/*/*.xml]
...
[monitor:///path/to/files/*/*.err]
...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then you can extract that unique directory using rex expression. You can then put those together in a transaction and search for the failure string from the .err file and extract the values you need&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search |  rex "\/path\/to\/files\/(?P&amp;lt;transID&amp;gt;[\w\d]*\/.*" | transaction transID | xmlkv | table field1 field2 SENDID GFM
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Oct 2014 19:01:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-and-chart-data-from-multiple-files-in-the-same/m-p/173387#M49713</guid>
      <dc:creator>jeremiahc4</dc:creator>
      <dc:date>2014-10-21T19:01:29Z</dc:date>
    </item>
  </channel>
</rss>

