<?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 use regex to extract from _raw and return in table format? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551644#M156541</link>
    <description>&lt;P&gt;Partly works--see above reply.&amp;nbsp; Thanks for your help.&lt;/P&gt;</description>
    <pubDate>Fri, 14 May 2021 17:56:21 GMT</pubDate>
    <dc:creator>DLT76</dc:creator>
    <dc:date>2021-05-14T17:56:21Z</dc:date>
    <item>
      <title>How to use regex to extract from _raw and return in table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551634#M156537</link>
      <description>&lt;P&gt;I have logs with data in two fields: _raw and _time. I want to search the _raw field for an IP in a specific pattern and return a URL the follows the IP. I'd like to see it in a table in one column named "url" and also show the date/time a second column using the contents of the _time field.&lt;/P&gt;&lt;P&gt;Here's an example of the data in _raw:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  [1.2.3.4 lookup] : http://www.dummy-url.com/ -- &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to use a query like the following which will look for a specified IP and return the URL that follows after the colon:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;rex field=_raw "1.2.3.4 lookup\] \: (?&amp;lt;url&amp;gt;[\w\:\/\.\-]+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The datasource looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype="datasource.out"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me with a query that searches for the IP and returns the URL (from _raw) and date/time (from _time) in table format?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 17:25:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551634#M156537</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2021-05-14T17:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex to extract from _raw and return in table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551638#M156538</link>
      <description>&lt;P&gt;Will this work?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype="datasource.out"
| rex field=_raw "1.2.3.4 lookup\] \: (?&amp;lt;url&amp;gt;[\w\:\/\.\-]+)"
| table url _time&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 14 May 2021 17:41:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551638#M156538</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-05-14T17:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex to extract from _raw and return in table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551639#M156539</link>
      <description>&lt;P&gt;You appear to have everything you need except for the &lt;FONT face="courier new,courier"&gt;table&lt;/FONT&gt; command.&amp;nbsp; What do you get with this query?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=foo sourcetype="datasource.out"
| rex field=_raw "1.2.3.4 lookup\] \: (?&amp;lt;url&amp;gt;[\w\:\/\.\-]+)"
| table _time url&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 17:45:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551639#M156539</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-05-14T17:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex to extract from _raw and return in table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551643#M156540</link>
      <description>&lt;P&gt;It does return a table with the date/time in one column, but the url column is blank.&amp;nbsp; It appears to be returning a row for every row during the date range.&amp;nbsp; I know I have rows with the IP in the _raw field because I get back rows when I search my source for just the IP in quotes.&amp;nbsp; And the regex looks good.&amp;nbsp; From regex101:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 515px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/14153iE9E1DADDC9FA8777/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Ideas?&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 17:55:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551643#M156540</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2021-05-14T17:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex to extract from _raw and return in table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551644#M156541</link>
      <description>&lt;P&gt;Partly works--see above reply.&amp;nbsp; Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 17:56:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551644#M156541</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2021-05-14T17:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex to extract from _raw and return in table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551647#M156542</link>
      <description>&lt;P&gt;Update:&amp;nbsp; It does appear to return every row from the raw field (or at least many more than have the specific IP), but when I sorted on the empty url column, I found that there are some rows with data, but they're not all URLs.&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 18:02:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551647#M156542</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2021-05-14T18:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex to extract from _raw and return in table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551649#M156543</link>
      <description>&lt;P&gt;You could make the match more specific&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype="datasource.out"
| rex field=_raw "1.2.3.4 lookup\] \: (?&amp;lt;url&amp;gt;http[\w\:\/\.\-]+)"
| table url _time&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 14 May 2021 18:07:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551649#M156543</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-05-14T18:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex to extract from _raw and return in table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551651#M156544</link>
      <description>&lt;P&gt;Update #2:&lt;/P&gt;&lt;P&gt;So when I add a field for the ip address and display it in the table and sort on that column, I find matching results (yay!), but I'm also getting tons of records that don't match.&amp;nbsp; Here's the new query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype="datasource.out" | rex field=_raw "(?&amp;lt;ipaddress&amp;gt;1.2.3.4) lookup\] \: (?&amp;lt;url&amp;gt;[\w\:\/\.\-]+)" | table _time url ipaddress&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to update the query to exclude non-matches from the table?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture2.PNG" style="width: 995px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/14154i39AABD84176C695B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture2.PNG" alt="Capture2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 18:11:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551651#M156544</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2021-05-14T18:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex to extract from _raw and return in table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551652#M156545</link>
      <description>&lt;P&gt;Good idea--I thought of that too, but the table still returns gazillions of records that don't match, and the url and ipaddress fields are blank.&amp;nbsp; I'd like to see in the table only records that have a matching IP (see reply above).&amp;nbsp; Thanks again!&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 18:13:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551652#M156545</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2021-05-14T18:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex to extract from _raw and return in table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551653#M156546</link>
      <description>&lt;P&gt;Update #3 (and solution):&lt;/P&gt;&lt;P&gt;I think I figured it out.&amp;nbsp; I added this to the end of the query:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; | where ipaddress != ""&lt;/LI-CODE&gt;&lt;P&gt;And now my table shows only those rows where the IP address matches.&lt;/P&gt;&lt;P&gt;Thank you for the help!&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 18:18:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551653#M156546</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2021-05-14T18:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex to extract from _raw and return in table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551654#M156547</link>
      <description>&lt;P&gt;I think I figured it out.&amp;nbsp; See Update #3 above.&amp;nbsp; I appreciate the assist!&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 18:19:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-extract-from-raw-and-return-in-table-format/m-p/551654#M156547</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2021-05-14T18:19:53Z</dc:date>
    </item>
  </channel>
</rss>

