<?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 correlate fields from two different sourcetypes spawning across multiple hosts? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-fields-from-two-different-sourcetypes-spawning/m-p/119501#M32066</link>
    <description>&lt;P&gt;You could do something like this maybe ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=access_combined uri_path="/context*"
| fields CLIENTIP uri_path
| append [search sourcetype=app_server IP_ADDRESS=*
| fields IP_ADDRESS company ]
| eval ip=coalesce(CLIENTIP, IP_ADDRESS)
| stats count  by context, ip, company 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Break down:&lt;BR /&gt;
Select relevant fields&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=access_combined uri_path="/context*"
| fields CLIENTIP uri_path
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Append a search of the second sourcetype:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| append [search sourcetype=app_server IP_ADDRESS=*
| fields IP_ADDRESS company ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Coalesce the IP fields:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval ip=coalesce(CLIENTIP, IP_ADDRESS)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Lastly, count the contexts&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count by context, ip, company 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 27 Jan 2015 18:26:09 GMT</pubDate>
    <dc:creator>aljohnson_splun</dc:creator>
    <dc:date>2015-01-27T18:26:09Z</dc:date>
    <item>
      <title>How to correlate fields from two different sourcetypes spawning across multiple hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-fields-from-two-different-sourcetypes-spawning/m-p/119500#M32065</link>
      <description>&lt;P&gt;Hello Guys,&lt;/P&gt;

&lt;P&gt;I have a problem in correlating fields spawning across multiple hosts and different sourcetypes.&lt;/P&gt;

&lt;P&gt;Here is how our setup looks like:&lt;/P&gt;

&lt;P&gt;Apache access Log&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;CLIENTIP - - [27/Jan/2015:01:49:35 -0500] "POST /context1 HTTP/1.1" 200 295 "-" "unknown" "JSESSIONID" "-"
CLIENTIP - - [27/Jan/2015:01:49:35 -0500] "POST /context2 HTTP/1.1" 200 1896 "-" "unknown" "JSESSIONID" "-"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;App Server Logs&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;01:49:35,580 INFO  [CLASS_NAME] [IP_ADDRESS] [1422341129579] [Company_ID,COMPANY_NAME,OTHER_DETAIL1,OTHER_DETAIL2,OTHER_DETAIL3,OTHER_DETAIL4,OTHER_DETAIL5] Time to generate SQL: 0.503659ms
01:45:35,580 INFO  [CLASS_NAME] [IP_ADDRESS] [1422341129579] [Company_ID,COMPANY_NAME,OTHER_DETAIL1,OTHER_DETAIL2,OTHER_DETAIL3,OTHER_DETAIL4,OTHER_DETAIL5] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H2&gt;Requirement:&lt;/H2&gt;

&lt;P&gt;I want to be able to search for all CLIENT IPs in my Apache's access logs which have the context 'context1', take those CLIENT IPs and search them in my app server logs (the field name will be different here) and then get out the company name from my app server logs.&lt;/P&gt;

&lt;P&gt;Basically I want to be able to create a report of how many requests per company has come in for a given context.&lt;/P&gt;

&lt;P&gt;Could somebody please help me with this?&lt;BR /&gt;
Regards,&lt;BR /&gt;
Abhi&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jan 2015 09:17:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-fields-from-two-different-sourcetypes-spawning/m-p/119500#M32065</guid>
      <dc:creator>AbhinandGokul</dc:creator>
      <dc:date>2015-01-27T09:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to correlate fields from two different sourcetypes spawning across multiple hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-fields-from-two-different-sourcetypes-spawning/m-p/119501#M32066</link>
      <description>&lt;P&gt;You could do something like this maybe ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=access_combined uri_path="/context*"
| fields CLIENTIP uri_path
| append [search sourcetype=app_server IP_ADDRESS=*
| fields IP_ADDRESS company ]
| eval ip=coalesce(CLIENTIP, IP_ADDRESS)
| stats count  by context, ip, company 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Break down:&lt;BR /&gt;
Select relevant fields&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=access_combined uri_path="/context*"
| fields CLIENTIP uri_path
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Append a search of the second sourcetype:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| append [search sourcetype=app_server IP_ADDRESS=*
| fields IP_ADDRESS company ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Coalesce the IP fields:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval ip=coalesce(CLIENTIP, IP_ADDRESS)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Lastly, count the contexts&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count by context, ip, company 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Jan 2015 18:26:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-fields-from-two-different-sourcetypes-spawning/m-p/119501#M32066</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-01-27T18:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to correlate fields from two different sourcetypes spawning across multiple hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-fields-from-two-different-sourcetypes-spawning/m-p/119502#M32067</link>
      <description>&lt;P&gt;Unfortunately, the way SPLUNK has been set up IP_ADDRESS in my app server logs is not a field but it is just a log entry. This would not work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Abhi&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jan 2015 05:37:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-fields-from-two-different-sourcetypes-spawning/m-p/119502#M32067</guid>
      <dc:creator>AbhinandGokul</dc:creator>
      <dc:date>2015-01-29T05:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to correlate fields from two different sourcetypes spawning across multiple hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-fields-from-two-different-sourcetypes-spawning/m-p/119503#M32068</link>
      <description>&lt;P&gt;I think this is closer to working than you might think. Even if you don't want to add a field extraction for IP_ADDRESS you could easily pull it out with a "rex" command. &lt;/P&gt;

&lt;P&gt;The only other comment is I might try to do this with just an OR clause in the base search to get events from both logs. &lt;/P&gt;</description>
      <pubDate>Fri, 30 Jan 2015 22:02:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-fields-from-two-different-sourcetypes-spawning/m-p/119503#M32068</guid>
      <dc:creator>cpride_splunk</dc:creator>
      <dc:date>2015-01-30T22:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to correlate fields from two different sourcetypes spawning across multiple hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-fields-from-two-different-sourcetypes-spawning/m-p/119504#M32069</link>
      <description>&lt;P&gt;Thanks! After extracting it out as a field it started working! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Feb 2015 08:01:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-fields-from-two-different-sourcetypes-spawning/m-p/119504#M32069</guid>
      <dc:creator>AbhinandGokul</dc:creator>
      <dc:date>2015-02-02T08:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to correlate fields from two different sourcetypes spawning across multiple hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-fields-from-two-different-sourcetypes-spawning/m-p/119505#M32070</link>
      <description>&lt;P&gt;Sorry I just saw your comment now or else I would've responded.&lt;/P&gt;

&lt;P&gt;Glad to hear it is working ! &lt;/P&gt;</description>
      <pubDate>Mon, 02 Feb 2015 17:06:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-fields-from-two-different-sourcetypes-spawning/m-p/119505#M32070</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-02-02T17:06:50Z</dc:date>
    </item>
  </channel>
</rss>

