<?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 a value from a field with spaces? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208010#M60634</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SIP/3102-in-* you=* | rex "id=\"\"(?&amp;lt;id&amp;gt;[^\"]+)" |  table you, id
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 01 Aug 2016 15:21:06 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-08-01T15:21:06Z</dc:date>
    <item>
      <title>How to extract a value from a field with spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208009#M60633</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'm doing a simple alert, which looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SIP/3102-in-* you=* | table you, id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which should extract 2 tables from message like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Aug  1 10:40:08 192.168.1.201 Aug  1 10:39:17 asterisk[4015]: VERBOSE[4015]:     -- Executing [s@default:1] Set("SIP/3102-in-00000000", "you=11111111111|id=""Caller ID""") in new stack
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I get in return is actually this:&lt;/P&gt;

&lt;P&gt;"11111111 Caller" (in a table form of course), but the ID is missing. Anything that comes in only the first word before space is shown. &lt;/P&gt;

&lt;P&gt;I understand it's due to the way I extract it, but I'm really not sure how to form a search to make it properly produce the full string.  Any help is appreciated. &lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 14:52:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208009#M60633</guid>
      <dc:creator>yozhbk</dc:creator>
      <dc:date>2016-08-01T14:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a value from a field with spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208010#M60634</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SIP/3102-in-* you=* | rex "id=\"\"(?&amp;lt;id&amp;gt;[^\"]+)" |  table you, id
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Aug 2016 15:21:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208010#M60634</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-01T15:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a value from a field with spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208011#M60635</link>
      <description>&lt;P&gt;Try adding &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "id=\"\"(?&amp;lt;id&amp;gt;[^\"]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to your search or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;extract-ID=id=\"\"(?&amp;lt;id&amp;gt;[^\"]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to your props.conf stanza for this sourcetype.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 15:27:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208011#M60635</guid>
      <dc:creator>Jeremiah</dc:creator>
      <dc:date>2016-08-01T15:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a value from a field with spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208012#M60636</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;It worked for one of the entrees, but not the others... The length is always changing and so does the placement of the space, basicly its a callers ID that i`m trying to extract. &lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 15:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208012#M60636</guid>
      <dc:creator>yozhbk</dc:creator>
      <dc:date>2016-08-01T15:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a value from a field with spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208013#M60637</link>
      <description>&lt;P&gt;Thanks, but it seems to only work on some messages and not others.... &lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 15:33:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208013#M60637</guid>
      <dc:creator>yozhbk</dc:creator>
      <dc:date>2016-08-01T15:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a value from a field with spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208014#M60638</link>
      <description>&lt;P&gt;You would have more/better help if you actually posted examples and said "it worked for these ... but didn't work for those ...". Give as much detail as possible.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 15:38:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208014#M60638</guid>
      <dc:creator>gabriel_vasseur</dc:creator>
      <dc:date>2016-08-01T15:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a value from a field with spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208015#M60639</link>
      <description>&lt;P&gt;This regex looks for  &lt;CODE&gt;id=""&lt;/CODE&gt; and captures everything after that till &lt;CODE&gt;"&lt;/CODE&gt;, so the length should matter, as long as &lt;CODE&gt;id=""&lt;/CODE&gt; exists. Can you share a sample where it doesn't match&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 15:38:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208015#M60639</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-01T15:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a value from a field with spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208016#M60640</link>
      <description>&lt;P&gt;I think I got it, in the example I showed, I was testing with double "" around the ID= field, so it worked with that. But my regular messages look like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Aug  1 11:27:04 192.168.1.201 Aug  1 11:26:13 asterisk[4015]: VERBOSE[4015]:     -- Executing [s@default:1] Set("SIP/3102-in-00000000", "you=111111111|id=CALLER ID") in new stack
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Really sorry for the confusion. I can add the double "" back, but I really do want to understand why just changing to &lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 15:45:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208016#M60640</guid>
      <dc:creator>yozhbk</dc:creator>
      <dc:date>2016-08-01T15:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a value from a field with spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208017#M60641</link>
      <description>&lt;P&gt;rex "id=\"\"(?[^)]+)"  doesnt work ?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 15:58:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208017#M60641</guid>
      <dc:creator>yozhbk</dc:creator>
      <dc:date>2016-08-01T15:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a value from a field with spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208018#M60642</link>
      <description>&lt;P&gt;&lt;CODE&gt;rex "id=\"\"(?[^)]+)"&lt;/CODE&gt; will not work because it is expecting r &lt;CODE&gt;"&lt;/CODE&gt; after &lt;CODE&gt;=&lt;/CODE&gt;. In your data, it appears, there's no quotes after the = sign. To capture, when no quotes, try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SIP/3102-in-* you=* | rex "id=(?&amp;lt;id&amp;gt;[^\"]+)" |  table you, id
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Aug 2016 16:06:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208018#M60642</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-01T16:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a value from a field with spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208019#M60643</link>
      <description>&lt;P&gt;Guys thank you so much. I figured it out. I guess I need to pay more attention. This is what my final search string looks like...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SIP/3102-in-* you=* | rex "id=(?[^\"]+)" |  table you, id
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Aug 2016 17:05:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208019#M60643</guid>
      <dc:creator>yozhbk</dc:creator>
      <dc:date>2016-08-01T17:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a value from a field with spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208020#M60644</link>
      <description>&lt;P&gt;@yozhbk, please accept the answer to close it out &lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 17:27:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-value-from-a-field-with-spaces/m-p/208020#M60644</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-01T17:27:41Z</dc:date>
    </item>
  </channel>
</rss>

