<?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: Why is my field extraction not consistent across all events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272987#M82226</link>
    <description>&lt;P&gt;Unfortunately, it doesn't work. The field can't be extracted in some events.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Feb 2017 16:49:16 GMT</pubDate>
    <dc:creator>diavolo</dc:creator>
    <dc:date>2017-02-01T16:49:16Z</dc:date>
    <item>
      <title>Why is my field extraction not consistent across all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272985#M82224</link>
      <description>&lt;P&gt;I want to extract a field which is uuid format and name it &lt;CODE&gt;instanceid&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;props.conf settings&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-fields_5 = \[[i]nstance:\s+(?P&amp;lt;instanceid&amp;gt;[0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12})
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For logs like ...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2017-01-01 00:00:00.000 99999 INFO xxxxxxxxxxxx [-] [instance: 01234567-89ab-cdef-0123-456789abcdef] Instance destroyed successfully.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, it works for some events but it doesn't for some other events.&lt;BR /&gt;
When I changed the field name to &lt;CODE&gt;nstanceid&lt;/CODE&gt; or &lt;CODE&gt;istanceid&lt;/CODE&gt; in regex, it works for all events. I don't know what's wrong with the field name &lt;CODE&gt;instanceid&lt;/CODE&gt;.&lt;BR /&gt;
OTOH, &lt;CODE&gt;rex&lt;/CODE&gt; command with above regex (field name is &lt;CODE&gt;instanceid&lt;/CODE&gt;) works well.&lt;/P&gt;

&lt;P&gt;Would somebody give me the reason why??&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 16:05:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272985#M82224</guid>
      <dc:creator>diavolo</dc:creator>
      <dc:date>2017-02-01T16:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my field extraction not consistent across all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272986#M82225</link>
      <description>&lt;P&gt;Hi diavolo,&lt;/P&gt;

&lt;P&gt;try the following.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?:\[instance:\s+)(?P&amp;lt;instanceid&amp;gt;[0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12})(?:\])
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Should work fine now. &lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 16:20:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272986#M82225</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2017-02-01T16:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my field extraction not consistent across all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272987#M82226</link>
      <description>&lt;P&gt;Unfortunately, it doesn't work. The field can't be extracted in some events.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 16:49:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272987#M82226</guid>
      <dc:creator>diavolo</dc:creator>
      <dc:date>2017-02-01T16:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my field extraction not consistent across all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272988#M82227</link>
      <description>&lt;P&gt;1) when you say "change the field name" are you talking about the underlying data, or the field name being extracted by the regex?&lt;BR /&gt;
2) can you post an example of an event that the extract did NOT work for?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 17:36:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272988#M82227</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-02-01T17:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my field extraction not consistent across all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272989#M82228</link>
      <description>&lt;P&gt;1) The latter one. I changed regex from &lt;CODE&gt;(?P&amp;lt;instanceid&amp;gt;...)&lt;/CODE&gt; to &lt;CODE&gt;(?P&amp;lt;nstanceid&amp;gt;...)&lt;/CODE&gt;. It worked.&lt;BR /&gt;
2) &lt;BR /&gt;
- Worked:&lt;BR /&gt;
2017-01-06 03:08:35.416 21995 INFO nova.virt.libvirt.driver [-] [instance: 40624b9c-8179-4cb0-82ec-924ee5362cc0] Instance destroyed successfully.&lt;BR /&gt;
- Not Worked:&lt;BR /&gt;
2017-01-06 03:07:25.932 21995 DEBUG nova.network.neutronv2.api [-] [instance: 6708c71b-0f49-4b0b-8040-fec13e3e2a4b] get_instance_nw_info() _get_instance_nw_info /usr/lib/python2.7/site-packages/nova/network/neutronv2/api.py:602&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:41:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272989#M82228</guid>
      <dc:creator>diavolo</dc:creator>
      <dc:date>2020-09-29T12:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my field extraction not consistent across all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272990#M82229</link>
      <description>&lt;P&gt;The problem may be the (?P at the beginning of the regex.  &lt;/P&gt;

&lt;P&gt;Also, I believe you can shorthand hex digits as \h, so your regex can look a bit cleaner if you try this -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; EXTRACT-fields_5 = \[instance:\s+(?&amp;lt;instanceid&amp;gt;\h{8}\-\h{4}\-\h{4}\-\h{4}\-\h{12})
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;see this page for more details - &lt;A href="http://www.regular-expressions.info/refext.html"&gt;http://www.regular-expressions.info/refext.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 18:58:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272990#M82229</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-02-01T18:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my field extraction not consistent across all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272991#M82230</link>
      <description>&lt;P&gt;Hi diavolo,&lt;/P&gt;

&lt;P&gt;my guess would be that in some events there is actually a field called &lt;CODE&gt;instanceid&lt;/CODE&gt;. &lt;BR /&gt;
Try to use a completely new/different field name to test your field extraction, something like this should work for you:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; \[instance:\s+(?&amp;lt;ThisIsMyTestFieldName&amp;gt;[^\]]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 19:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272991#M82230</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2017-02-01T19:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my field extraction not consistent across all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272992#M82231</link>
      <description>&lt;P&gt;Thanks MuS,&lt;BR /&gt;
&lt;CODE&gt;instanceid&lt;/CODE&gt; is not used anywhere. Changing field name like &lt;CODE&gt;instance_id&lt;/CODE&gt; works fine. But I was wondering why...&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 03:02:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272992#M82231</guid>
      <dc:creator>diavolo</dc:creator>
      <dc:date>2017-02-02T03:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my field extraction not consistent across all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272993#M82232</link>
      <description>&lt;P&gt;? didn't fix the problem... Also, \h for hex didn't work.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 04:16:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272993#M82232</guid>
      <dc:creator>diavolo</dc:creator>
      <dc:date>2017-02-02T04:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my field extraction not consistent across all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272994#M82233</link>
      <description>&lt;P&gt;Mmm... After I changed the extracted field name in regex from &lt;CODE&gt;instanceid&lt;/CODE&gt; to &lt;CODE&gt;instance_id&lt;/CODE&gt; for workaround, it doesn't work for some events. It worked fine soon after I did change, but 1 hour later, it doesn't.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 05:12:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272994#M82233</guid>
      <dc:creator>diavolo</dc:creator>
      <dc:date>2017-02-02T05:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my field extraction not consistent across all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272995#M82234</link>
      <description>&lt;P&gt;Could you provide us with the exakt event _raw payload that doesn't match this regex?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 14:51:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272995#M82234</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2017-02-02T14:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my field extraction not consistent across all events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272996#M82235</link>
      <description>&lt;P&gt;The problem is two-fold: either the event does not have what you think all of them does (non-conforming event data) OR your RegEx is slightly off and does not fully accommodate all variations of the events (insufficient RegEx).  In either case, here is what you need to do to figure it out.  Deploy the version that works best, let's say that you are using a field name of &lt;CODE&gt;instance_id&lt;/CODE&gt;.  Then run a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... NOT instance_id="*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will show you all events that do not have a field called &lt;CODE&gt;instance_id&lt;/CODE&gt;.  You adjust your RegEx or ignore that type of event (by putting an exclusion for it in your base search) and keep repeating this cycle until you have no events returned from that search.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 19:56:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-field-extraction-not-consistent-across-all-events/m-p/272996#M82235</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-02T19:56:31Z</dc:date>
    </item>
  </channel>
</rss>

