<?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 Coalesce in transforms in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Coalesce-in-transforms/m-p/397898#M70949</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am working with some apache logs that &lt;EM&gt;can&lt;/EM&gt; go through one or more proxies, when a request go through a proxy a X-forwarded-for header is added. The problem is that the apache logs show the client IP as the last address the request came from. The logs do however add the X-forwarded-for entries to the end of the log entry if they exist.&lt;/P&gt;

&lt;P&gt;What I need to do is get the clientip field updated via transforms to the correct address so that the web analytics app gets the correct data. The following search shows an example of the goal.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=weblogs
| rex field=other "^(?&amp;lt;first_forward&amp;gt;[0-9\.]+)"
| eval clientip=coalesce(first_forward, clientip)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;EM&gt;other&lt;/EM&gt; field is already extracted and contains a comma separated list of the X-forwarded-for headers.&lt;/P&gt;

&lt;P&gt;I see two options on how to solve this, unless there is some magic way to do evals in transforms/props.&lt;/P&gt;

&lt;P&gt;1) I could create a regex to extract the values in transforms, but not sure how to coalesce them in transforms/props.&lt;/P&gt;

&lt;P&gt;2) Create a macro that does the job, but then I would need to update every search in the app and this would make updating the app lame.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
    <pubDate>Thu, 09 Aug 2018 18:12:15 GMT</pubDate>
    <dc:creator>knutsod</dc:creator>
    <dc:date>2018-08-09T18:12:15Z</dc:date>
    <item>
      <title>Coalesce in transforms</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Coalesce-in-transforms/m-p/397898#M70949</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am working with some apache logs that &lt;EM&gt;can&lt;/EM&gt; go through one or more proxies, when a request go through a proxy a X-forwarded-for header is added. The problem is that the apache logs show the client IP as the last address the request came from. The logs do however add the X-forwarded-for entries to the end of the log entry if they exist.&lt;/P&gt;

&lt;P&gt;What I need to do is get the clientip field updated via transforms to the correct address so that the web analytics app gets the correct data. The following search shows an example of the goal.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=weblogs
| rex field=other "^(?&amp;lt;first_forward&amp;gt;[0-9\.]+)"
| eval clientip=coalesce(first_forward, clientip)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;EM&gt;other&lt;/EM&gt; field is already extracted and contains a comma separated list of the X-forwarded-for headers.&lt;/P&gt;

&lt;P&gt;I see two options on how to solve this, unless there is some magic way to do evals in transforms/props.&lt;/P&gt;

&lt;P&gt;1) I could create a regex to extract the values in transforms, but not sure how to coalesce them in transforms/props.&lt;/P&gt;

&lt;P&gt;2) Create a macro that does the job, but then I would need to update every search in the app and this would make updating the app lame.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Aug 2018 18:12:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Coalesce-in-transforms/m-p/397898#M70949</guid>
      <dc:creator>knutsod</dc:creator>
      <dc:date>2018-08-09T18:12:15Z</dc:date>
    </item>
  </channel>
</rss>

