<?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 Do I Capture Apache Logs into the x-forwarder-for value to search in Splunk? in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/How-Do-I-Capture-Apache-Logs-into-the-x-forwarder-for-value-to/m-p/298617#M5178</link>
    <description>&lt;P&gt;Thanks! I'm about to try this - does this mean that no changes need to be made to the servers themselves as far as the formatting I've done for conf.d and extended_logging.conf? Or this is in addition to that? It would be great if this method worked without having to do special configurations of the servers. &lt;/P&gt;</description>
    <pubDate>Sat, 08 Jul 2017 23:05:07 GMT</pubDate>
    <dc:creator>heats</dc:creator>
    <dc:date>2017-07-08T23:05:07Z</dc:date>
    <item>
      <title>How Do I Capture Apache Logs into the x-forwarder-for value to search in Splunk?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-Do-I-Capture-Apache-Logs-into-the-x-forwarder-for-value-to/m-p/298613#M5174</link>
      <description>&lt;P&gt;Trying to capture the IP address out of the apache logs and into the x-forwarded-for field in Splunk&lt;/P&gt;

&lt;P&gt;I've added the following line to httpd.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# Include generic snippets of statements
Include /etc/httpd/conf.d/*.conf
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I've created extended_logging.conf and adding the following formatting syntax:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;LogFormat "%v %p %h %a %l %u %t %D %m \"%U%q\" \"%U\" \"%q\" %&amp;gt;s %b \"%{Referer}i\" \"%{User-agent}i\" \"%{X-Forwarded-For}i\" \"%{Cookie}i\"" extended
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've restarted the Apache service and the splunk service on the host but searching Splunk on that host I am still not seeing the x-forwarded-for value pop up in Interesting Fields in the GUI. &lt;/P&gt;

&lt;P&gt;This box is a RHEL6 box. Has anyone gotten x-forwarded-for working for Apache logs that may know of a step I missed? &lt;/P&gt;

&lt;P&gt;Thanks! &lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 14:27:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-Do-I-Capture-Apache-Logs-into-the-x-forwarder-for-value-to/m-p/298613#M5174</guid>
      <dc:creator>heats</dc:creator>
      <dc:date>2017-07-07T14:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: How Do I Capture Apache Logs into the x-forwarder-for value to search in Splunk?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-Do-I-Capture-Apache-Logs-into-the-x-forwarder-for-value-to/m-p/298614#M5175</link>
      <description>&lt;P&gt;I just did an automatic field extraction to get ours to have the x-forwarded-for field extracted properly. Yes, it is an additional field extraction, but that is what Splunk is good at, right?&lt;/P&gt;

&lt;P&gt;If you need any help with the field extraction regex, just let me know with a comment and I'll add it here.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 14:39:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-Do-I-Capture-Apache-Logs-into-the-x-forwarder-for-value-to/m-p/298614#M5175</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-07-07T14:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: How Do I Capture Apache Logs into the x-forwarder-for value to search in Splunk?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-Do-I-Capture-Apache-Logs-into-the-x-forwarder-for-value-to/m-p/298615#M5176</link>
      <description>&lt;P&gt;I'm actually not even sure what the automatic field extraction is and how it works. So additional help with how it works and the regex would be greatly appreciated! Thanks so much. &lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 17:41:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-Do-I-Capture-Apache-Logs-into-the-x-forwarder-for-value-to/m-p/298615#M5176</guid>
      <dc:creator>heats</dc:creator>
      <dc:date>2017-07-07T17:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: How Do I Capture Apache Logs into the x-forwarder-for value to search in Splunk?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-Do-I-Capture-Apache-Logs-into-the-x-forwarder-for-value-to/m-p/298616#M5177</link>
      <description>&lt;P&gt;From &lt;CODE&gt;Settings -&amp;gt; Fields -&amp;gt; Field Extractions -&amp;gt; New&lt;/CODE&gt; you can create an automatic field extraction. The &lt;CODE&gt;application&lt;/CODE&gt; needs to be specified, along with either &lt;CODE&gt;source&lt;/CODE&gt; or &lt;CODE&gt;sourcetype&lt;/CODE&gt; as the means of deciding what date you will be doing the field extraction on. I'd suggest &lt;CODE&gt;sourcetype&lt;/CODE&gt; and then select the sourcetype of the data you are needing to extract the &lt;CODE&gt;x_forwarded_for&lt;/CODE&gt; field in. Leave the Type on &lt;CODE&gt;Inline&lt;/CODE&gt; and then enter the following in the &lt;CODE&gt;Extraction/Transform&lt;/CODE&gt; textbox (you may have to modify it slightly if your data is different from mine):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;x_forwarded_for:"(?P&amp;lt;x_forwarded_for&amp;gt;\d+\.\d+\.\d+\.\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That regular expression (regex) will extract the IP address from the data and put it in a field called &lt;CODE&gt;x_forwarded_for&lt;/CODE&gt;. Save that and then go search your data. You should then have the field automatically extracted for all the data with the sourcetype that you have selected.&lt;/P&gt;

&lt;P&gt;Here are some additional resources for doing this kind of thing (some references may be a bit older, but can give you an idea of what to do):&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/6.6.0/Knowledge/Aboutfields"&gt;http://docs.splunk.com/Documentation/SplunkCloud/6.6.0/Knowledge/Aboutfields&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ExtractfieldsinteractivelywithIFX"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ExtractfieldsinteractivelywithIFX&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://www.splunk.com/view/SP-CAAADUY"&gt;https://www.splunk.com/view/SP-CAAADUY&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 20:26:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-Do-I-Capture-Apache-Logs-into-the-x-forwarder-for-value-to/m-p/298616#M5177</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-07-07T20:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: How Do I Capture Apache Logs into the x-forwarder-for value to search in Splunk?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-Do-I-Capture-Apache-Logs-into-the-x-forwarder-for-value-to/m-p/298617#M5178</link>
      <description>&lt;P&gt;Thanks! I'm about to try this - does this mean that no changes need to be made to the servers themselves as far as the formatting I've done for conf.d and extended_logging.conf? Or this is in addition to that? It would be great if this method worked without having to do special configurations of the servers. &lt;/P&gt;</description>
      <pubDate>Sat, 08 Jul 2017 23:05:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-Do-I-Capture-Apache-Logs-into-the-x-forwarder-for-value-to/m-p/298617#M5178</guid>
      <dc:creator>heats</dc:creator>
      <dc:date>2017-07-08T23:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: How Do I Capture Apache Logs into the x-forwarder-for value to search in Splunk?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-Do-I-Capture-Apache-Logs-into-the-x-forwarder-for-value-to/m-p/298618#M5179</link>
      <description>&lt;P&gt;&lt;EM&gt;As long as the logs contain the&lt;/EM&gt; &lt;CODE&gt;x_forwarded_for&lt;/CODE&gt; &lt;EM&gt;information in them&lt;/EM&gt;, this should work for you, but that is dependent on if it is already in the logs. Most Apache logs don't contain this information by default. We have some Apache servers that are configured to output the info to the logs, and some are not. YMMV. Check the log as it exists before making those changes.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jul 2017 00:11:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-Do-I-Capture-Apache-Logs-into-the-x-forwarder-for-value-to/m-p/298618#M5179</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-07-09T00:11:00Z</dc:date>
    </item>
  </channel>
</rss>

