<?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 search for a field name that a value exists for? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-name-that-a-value-exists-for/m-p/268199#M80685</link>
    <description>&lt;P&gt;You'd have to build a delimited list of fields, which is doable.  You want to output a list of fields that contain a value that ends in the literal string ".MD5" ?&lt;/P&gt;</description>
    <pubDate>Wed, 09 Dec 2015 21:41:49 GMT</pubDate>
    <dc:creator>hortonew</dc:creator>
    <dc:date>2015-12-09T21:41:49Z</dc:date>
    <item>
      <title>How to search for a field name that a value exists for?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-name-that-a-value-exists-for/m-p/268196#M80682</link>
      <description>&lt;P&gt;I've been noodling on a problem that I can't seem to easily solve.  We are bringing in JSON documents that describe files such as documents, executables, and container files.  Because of the nature of container files specifically, (that the nesting is not predictable) we know that there is going to be a field that will contain an MD5 for all of the objects in the container, but we don't know what they will be named (the field names are directly related to the container file structure, so will constantly change).  The field is generally in the following format: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;root.sub1.sub2.objectname.MD5=value
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With that said, what is a good way to search for an MD5 string against the whole dataset &amp;amp; then return the field name?  If I can figure that out, then I can probably string together the rest to grab other objects from the event.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2015 15:07:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-name-that-a-value-exists-for/m-p/268196#M80682</guid>
      <dc:creator>ltrand</dc:creator>
      <dc:date>2015-12-09T15:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for a field name that a value exists for?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-name-that-a-value-exists-for/m-p/268197#M80683</link>
      <description>&lt;P&gt;If you don't know what field contains an md5 hash, something like the following will loop over all fields in an event, and create a new field for md5 that you can parse later on&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | eval field1="098f6bcd4621d373cade4e832627b4f6" | head 1 | foreach * [rex field=&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; "^(?&amp;lt;md5&amp;gt;[a-f0-9]{32}$)"] | table _time, md5
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Dec 2015 17:28:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-name-that-a-value-exists-for/m-p/268197#M80683</guid>
      <dc:creator>hortonew</dc:creator>
      <dc:date>2015-12-09T17:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for a field name that a value exists for?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-name-that-a-value-exists-for/m-p/268198#M80684</link>
      <description>&lt;P&gt;Would there be a way to eval the field name to discover all that end in .MD5?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2015 21:34:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-name-that-a-value-exists-for/m-p/268198#M80684</guid>
      <dc:creator>ltrand</dc:creator>
      <dc:date>2015-12-09T21:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for a field name that a value exists for?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-name-that-a-value-exists-for/m-p/268199#M80685</link>
      <description>&lt;P&gt;You'd have to build a delimited list of fields, which is doable.  You want to output a list of fields that contain a value that ends in the literal string ".MD5" ?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2015 21:41:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-name-that-a-value-exists-for/m-p/268199#M80685</guid>
      <dc:creator>hortonew</dc:creator>
      <dc:date>2015-12-09T21:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for a field name that a value exists for?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-name-that-a-value-exists-for/m-p/268200#M80686</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | eval TestField="This has matching MD5=098f6bcd4621d373cade4e832627b4f6 string" | head 1 | foreach * [eval firstFieldWithString=if((isnull(firstFieldWithString) AND like(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;, "%098f6bcd4621d373cade4e832627b4f6%")), "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;", firstFieldWithString) ] | table _time, firstFieldWithString
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Dec 2015 00:20:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-name-that-a-value-exists-for/m-p/268200#M80686</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-12-10T00:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for a field name that a value exists for?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-name-that-a-value-exists-for/m-p/268201#M80687</link>
      <description>&lt;P&gt;Hi ltrand,&lt;/P&gt;

&lt;P&gt;this basic run everywhere search will match all fields that end with &lt;CODE&gt;.MD5&lt;/CODE&gt; and get the value into a new field called &lt;CODE&gt;md5&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 
| eval myRaw="root.sub1.sub2.objectname.MD5=foo root.sub2.objectname.MD5=boo root.objectname.MD5=baz" 
| rex max_match=0 field=myRaw "\.MD5=(?&amp;lt;md5&amp;gt;[^\s]+)" 
| table md5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The first and second line is only needed to create some dummy events, so you won't need it. Tweak it as needed to match your events.&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 00:35:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-name-that-a-value-exists-for/m-p/268201#M80687</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-12-10T00:35:10Z</dc:date>
    </item>
  </channel>
</rss>

