<?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 associate a value generated by a host with a field/event outside of the source? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-associate-a-value-generated-by-a-host-with-a-field-event/m-p/152682#M31079</link>
    <description>&lt;P&gt;This is an overview of how my system produces a certain value:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/526i22A2D7604FC73FBF/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Usually each area has a set of hosts, but there are also a few hosts that do not. In this case, one host that is not part of an area is generating a value that I need to associate with an area.&lt;/P&gt;

&lt;P&gt;The name of the area can be found in the name of the source generated by the host such as &lt;CODE&gt;source=/log/areaName/rest_of_path&lt;/CODE&gt;. Would it be possible to create an association using just SPL or must the flow be top down like &lt;CODE&gt;area -- host -- value&lt;/CODE&gt;? How should I structure my search logic?&lt;/P&gt;

&lt;P&gt;The purpose of this is to be able to list the Value by Area so that each Area will have one Value.&lt;/P&gt;</description>
    <pubDate>Mon, 03 Aug 2015 12:01:39 GMT</pubDate>
    <dc:creator>ohlafl</dc:creator>
    <dc:date>2015-08-03T12:01:39Z</dc:date>
    <item>
      <title>How to associate a value generated by a host with a field/event outside of the source?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-associate-a-value-generated-by-a-host-with-a-field-event/m-p/152682#M31079</link>
      <description>&lt;P&gt;This is an overview of how my system produces a certain value:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/526i22A2D7604FC73FBF/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Usually each area has a set of hosts, but there are also a few hosts that do not. In this case, one host that is not part of an area is generating a value that I need to associate with an area.&lt;/P&gt;

&lt;P&gt;The name of the area can be found in the name of the source generated by the host such as &lt;CODE&gt;source=/log/areaName/rest_of_path&lt;/CODE&gt;. Would it be possible to create an association using just SPL or must the flow be top down like &lt;CODE&gt;area -- host -- value&lt;/CODE&gt;? How should I structure my search logic?&lt;/P&gt;

&lt;P&gt;The purpose of this is to be able to list the Value by Area so that each Area will have one Value.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2015 12:01:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-associate-a-value-generated-by-a-host-with-a-field-event/m-p/152682#M31079</guid>
      <dc:creator>ohlafl</dc:creator>
      <dc:date>2015-08-03T12:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a value generated by a host with a field/event outside of the source?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-associate-a-value-generated-by-a-host-with-a-field-event/m-p/152683#M31080</link>
      <description>&lt;P&gt;If I understand you correctly, you need the&lt;CODE&gt;coalesce&lt;/CODE&gt; command and can use it like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=source "/[^/]+/(?&amp;lt;areaName&amp;gt;)[^/]+/" | eval areaName=coalesce(areaName, host) | stats values(Value) by areaName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or, since every event will have a source so the &lt;CODE&gt;rex&lt;/CODE&gt; command will have false positives for the "null" case above, maybe you need the &lt;CODE&gt;if&lt;/CODE&gt; command like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=source "/[^/]+/(?&amp;lt;areaName&amp;gt;)[^/]+/" | eval areaName=if(myTestHere(areaName), areaName, host) | stats values(Value) by areaName
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Aug 2015 12:18:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-associate-a-value-generated-by-a-host-with-a-field-event/m-p/152683#M31080</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-03T12:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a value generated by a host with a field/event outside of the source?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-associate-a-value-generated-by-a-host-with-a-field-event/m-p/152684#M31081</link>
      <description>&lt;P&gt;This would seem about right, yes, I do however get an error with the rex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'rex' command: Encountered the following error while compiling the regex '/[^/]+/(?&amp;lt;areaName)[^/]+/': Regex: syntax error in subpattern name (missing terminator) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am not very familiar with regex, excuse my noobishness.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2015 13:52:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-associate-a-value-generated-by-a-host-with-a-field-event/m-p/152684#M31081</guid>
      <dc:creator>ohlafl</dc:creator>
      <dc:date>2015-08-03T13:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a value generated by a host with a field/event outside of the source?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-associate-a-value-generated-by-a-host-with-a-field-event/m-p/152685#M31082</link>
      <description>&lt;P&gt;Sorry, I had a typo in my RegEx but I fixed it.  Try it again.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2015 14:01:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-associate-a-value-generated-by-a-host-with-a-field-event/m-p/152685#M31082</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-03T14:01:48Z</dc:date>
    </item>
  </channel>
</rss>

