<?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 extract fields and assign values from my data with the field extractor utility? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-and-assign-values-from-my-data-with-the/m-p/156884#M44141</link>
    <description>&lt;P&gt;I think we have both fallen prey to trying to display code here and having some of it eaten or transformed. I just fixed mine, so take a look at it.  Stefanefotso has included accommodation for the newline... which will not exist if your events are broken and is completely unnecessary.  we're both saying, walk forward through the event, then when you get to the spot you want to grab... grab it.  &lt;/P&gt;</description>
    <pubDate>Fri, 24 Apr 2015 19:32:06 GMT</pubDate>
    <dc:creator>rsennett_splunk</dc:creator>
    <dc:date>2015-04-24T19:32:06Z</dc:date>
    <item>
      <title>How to extract fields and assign values from my data with the field extractor utility?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-and-assign-values-from-my-data-with-the/m-p/156880#M44137</link>
      <description>&lt;P&gt;I have a custom file which we don't have problems searching certain "strings" within, but what I cannot figure out is how to create a custom field and then assign values to search on it.  For instance, below is the query used to search for the 'string' with any IP Address thrown in between the single quotes at the end. I do not have issues returning the search. The issue is i want to use the field extractor to create fields. SEARCH:  &lt;STRONG&gt;index=INDEX sourcetype=INDEX_LOG "call failed: Unable to connect to server '*'"&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;Field Example: create a field called: "&lt;EM&gt;Unable to connect to server&lt;/EM&gt;" and within this field, i would be able to pull the IP Address values from it, distinguish the unique or duplicate values in a certain time frame. I hope that makes sense, i am new to splunk.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;SAMPLE LOG FILE in bold is the search term i'm mainly looking for:&lt;/STRONG&gt; &lt;BR /&gt;
09104464  5160 AB9D87B12528D94D8CEFD068DA0C2B48 AEJ00101/PRD20002       REQUEST         0 BPSEJLA1/290   UpdImgSt&lt;BR /&gt;
09104465  4108 9BC9B8192CFA92459E2353A4DABE24C6 AMN00101/PRD20002       REQUEST         0 BPSMONA1/349   RecAlertsWKS - WWS05656&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;09104465  4108 9BC9B8192CFA92459E2353A4DABE24C6 WSF05656/DEFAULT  E G R PGNP0008    10060 BPSMONA1/2698  Error: Windows API function 'connect' &lt;EM&gt;call failed: Unable to connect to server '12.34.56.78'&lt;/EM&gt;.,OT:100037/GMT-04,Suppressed=3&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;09104465  4108 9BC9B8192CFA92459E2353A4DABE24C6 WSF05656/DEFAULT  C N R PGNS0001    10060 BPSMONA1/2698  Network Transport Error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond...,OT:100037/GMT-04,Suppressed=3&lt;BR /&gt;
09104467  3496 8758A6696193044980CF175B2A678315 ABC00101/PRD20002       REQUEST         0 BPSBCLA1/714   OprUpdSt&lt;BR /&gt;
09104479  3372 93DA8C8A149B464590B928F80657C978 AOBCL101/PRD20002       SPCLTRCE        3 BPGCONTX/732   Data Insert Error&lt;BR /&gt;
09104483  3496 94B1FAB4D411B943A9CE71B93EF7E752 ABC00101/PRD20002       REQUEST         0 BPSBCLA1/714   ProcReq &lt;BR /&gt;
09&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2015 16:14:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-and-assign-values-from-my-data-with-the/m-p/156880#M44137</guid>
      <dc:creator>gmelasecca</dc:creator>
      <dc:date>2015-04-24T16:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields and assign values from my data with the field extractor utility?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-and-assign-values-from-my-data-with-the/m-p/156881#M44138</link>
      <description>&lt;P&gt;Hello!&lt;BR /&gt;
Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=INDEX sourcetype=INDEX_LOG....... |rex field=_raw "^(?:[^'\n]*'){3}(?P&amp;lt;Unable to connect to server&amp;gt;[^']+)"|table "Unable to connect to server"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=INDEX sourcetype=INDEX_LOG....... |rex field=_raw "^(?:[^'\n]*'){3}(?P&amp;lt;Unable_to_connect_to_server&amp;gt;\d+\.\d+\.\d+\.\d+)"|table Unable_to_connect_to_server
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Apr 2015 16:35:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-and-assign-values-from-my-data-with-the/m-p/156881#M44138</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-04-24T16:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields and assign values from my data with the field extractor utility?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-and-assign-values-from-my-data-with-the/m-p/156882#M44139</link>
      <description>&lt;P&gt;Let's walk through the events and then narrow down how to get to the values you want.&lt;BR /&gt;
Grab your sample, and use &lt;A href="http://regex101.com"&gt;regex101.com&lt;/A&gt; to see what I see.&lt;/P&gt;

&lt;P&gt;grab your sample and then put this regex in and turn on the g flag for global:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\d{8}\s+\d{4}\s+[^\s]+\s[^\s]+
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can see that the events match up to that point, so to be smart about it, again, more sample data would tell us a lot.&lt;BR /&gt;
Meanwhile you have something to grab on to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error:
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So to grab this in a field you would use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error:\s(?P&amp;lt;error&amp;gt;.+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Because you have the target to anchor on "Error:" it doesn't matter where it is in the event... &lt;/P&gt;

&lt;P&gt;Then to grab the IP address you can use &lt;CODE&gt;rex&lt;/CODE&gt; in line as follows  &lt;CODE&gt;rex field=error "(?Pd+\.\d+\.\d+\.\d+)"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Or you can put it in props.conf with this format:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-detail (?P&amp;lt;msg&amp;gt;unable.*) in error
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if you update the question with events that have errors, I can advise you further... but basically you're looking for something to hang on to. &lt;/P&gt;

&lt;P&gt;For efficiency... you would grab the ERROR field as a search time extraction and then start your searches with &lt;BR /&gt;
&lt;CODE&gt;index=blah sourcetype=foo error=*|...&lt;/CODE&gt;  or &lt;CODE&gt;index=blah sourcetype=foo|search  error=*|...&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2015 17:21:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-and-assign-values-from-my-data-with-the/m-p/156882#M44139</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2015-04-24T17:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields and assign values from my data with the field extractor utility?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-and-assign-values-from-my-data-with-the/m-p/156883#M44140</link>
      <description>&lt;P&gt;Unfortunately the first query resulted in a code error:&lt;BR /&gt;
Error in 'rex' command: Encountered the following error while compiling the regex '^(?:[^'\n]*'){3}(?P[^']+)': Regex: syntax error in sub-pattern name (missing terminator)&lt;/P&gt;

&lt;P&gt;the second query did not return the results expected. it actually just returned the first portion of my search: &lt;BR /&gt;
"call failed: Unable to connect to server '*'"  than displayed exactly the same as if i ran my original query.&lt;/P&gt;

&lt;P&gt;any thoughts? i can take a screen shot or show what was returned if needed.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2015 18:35:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-and-assign-values-from-my-data-with-the/m-p/156883#M44140</guid>
      <dc:creator>gmelasecca</dc:creator>
      <dc:date>2015-04-24T18:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields and assign values from my data with the field extractor utility?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-and-assign-values-from-my-data-with-the/m-p/156884#M44141</link>
      <description>&lt;P&gt;I think we have both fallen prey to trying to display code here and having some of it eaten or transformed. I just fixed mine, so take a look at it.  Stefanefotso has included accommodation for the newline... which will not exist if your events are broken and is completely unnecessary.  we're both saying, walk forward through the event, then when you get to the spot you want to grab... grab it.  &lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2015 19:32:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-and-assign-values-from-my-data-with-the/m-p/156884#M44141</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2015-04-24T19:32:06Z</dc:date>
    </item>
  </channel>
</rss>

