<?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: Help with regex to extract fields with different patterns in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306092#M91898</link>
    <description>&lt;P&gt;@DalJeanis &lt;/P&gt;

&lt;P&gt;Thanks for letting me know,I have edited and pasted the sample events&lt;/P&gt;</description>
    <pubDate>Mon, 28 Aug 2017 22:36:49 GMT</pubDate>
    <dc:creator>vrmandadi</dc:creator>
    <dc:date>2017-08-28T22:36:49Z</dc:date>
    <item>
      <title>Help with regex to extract fields with different patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306090#M91896</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;

&lt;P&gt;I am trying to extract some data from events of different patterns and saving in a field called Details,but I dont think regex can do that since it not following a pattern.I have below sample events and I have highlighted the text to be extracted in bold as a new field called "details".Is it possible??&lt;/P&gt;

&lt;P&gt;sample events&lt;/P&gt;

&lt;P&gt;Sample 1&lt;/P&gt;

&lt;P&gt;28 Aug 2017 22:33:49 [WARN ] http_srv: &lt;STRONG&gt;DONE&lt;/STRONG&gt; 1023533 0.023082 404[Not Found] UNKNOWN-ID 24.211.252.82:58699 GET &lt;A href="http://mmdai-linear-west-02.ti.com/linear-scope010.ti.com/LIVE/1024/hls/ae/HGTV_HD/.swnd8bdfc1a-7d30-4662-b4a8-005056b278dcapple2apple/.rate_300800/index_v_300800_1.m3u8?nw=376521&amp;amp;prof=376521:twc_hls_live&amp;amp;mode=live&amp;amp;vdur=600&amp;amp;caid=HGTV_LIVE&amp;amp;csid=stva_android_ph_live&amp;amp;vcid=bc409d5d-7878-3ed8-920c-f136710ca195&amp;amp;z5=27545&amp;amp;ads=VAST_LIVE&amp;amp;tagset_name=VAST&amp;amp;_fw_lpu=http://linear-scope010.ti.com/LIVE/1024/hl" target="_blank"&gt;http://mmdai-linear-west-02.ti.com/linear-scope010.ti.com/LIVE/1024/hls/ae/HGTV_HD/.swnd8bdfc1a-7d30-4662-b4a8-005056b278dcapple2apple/.rate_300800/index_v_300800_1.m3u8?nw=376521&amp;amp;prof=376521:twc_hls_live&amp;amp;mode=live&amp;amp;vdur=600&amp;amp;caid=HGTV_LIVE&amp;amp;csid=stva_android_ph_live&amp;amp;vcid=bc409d5d-7878-3ed8-920c-f136710ca195&amp;amp;z5=27545&amp;amp;ads=VAST_LIVE&amp;amp;tagset_name=VAST&amp;amp;_fw_lpu=http://linear-scope010.ti.com/LIVE/1024/hl&lt;/A&gt;... (id 19702873)&lt;BR /&gt;
sample 2&lt;/P&gt;

&lt;P&gt;28 Aug 2017 14:21:53 [WARN ] Content Generator: &lt;STRONG&gt;Client with unknown ID. Rejecting request&lt;/STRONG&gt; (id 30299754) - uuid 5777d11e-c8d6-49ac-a5b2-fa163e11220e&lt;/P&gt;

&lt;P&gt;sample3&lt;BR /&gt;
28 Aug 2017 20:21:53 [WARN ] http_cli: &lt;STRONG&gt;Origin latency exceeded threshold&lt;/STRONG&gt;: 0.183154 seconds GET Status: 200[OK] Bytes: 10087 Origin URL: &lt;A href="http://aa.video.cdn.ch.com/LIVE/1027/hls/ae/VH1HD/3400.m3u8" target="_blank"&gt;http://aa.video.cdn.ch.com/LIVE/1027/hls/ae/VH1HD/3400.m3u8&lt;/A&gt; refReqId 22804466 reqWait 0 (id 3314781656)&lt;/P&gt;

&lt;P&gt;sample4&lt;BR /&gt;
28 Aug 2017 20:41:08 [WARN ] Content Generator: &lt;STRONG&gt;Media Time Line Broken. Reset time line for session&lt;/STRONG&gt; 185d563a-dd54-4234-a38a-005056b20601 (id 1052189)&lt;/P&gt;

&lt;P&gt;Sample5&lt;BR /&gt;
28 Aug 2017 20:45:24 [WARN ] ManifestCache: &lt;STRONG&gt;Request Failed: add entry status&lt;/STRONG&gt; 404 url &lt;A href="http://mmdai-vod-west-01.ti.com/TWCTV_vod/ooh/vod-9.ti.com/HLS_DRM/move1572890050300002/index.m3u8" target="_blank"&gt;http://mmdai-vod-west-01.ti.com/TWCTV_vod/ooh/vod-9.ti.com/HLS_DRM/move1572890050300002/index.m3u8&lt;/A&gt; (id 3292891677)&lt;BR /&gt;
Sample 6&lt;BR /&gt;
28 Aug 2017 14:46:30 [INFO ] ManifestCache: &lt;STRONG&gt;HLS STATS: requests=0 reqHit=0 reqMiss=0 urlHit=0 urlMiss=0 toServer=0&lt;/STRONG&gt;&lt;BR /&gt;
Sample 7&lt;BR /&gt;
28 Aug 2017 20:47:30 [WARN ] ManifestCache: &lt;STRONG&gt;Sequence number jumped back from 2069693 to 2069689&lt;/STRONG&gt; for &lt;A href="http://linear-scope010.t.com/LIVE/2002/hls/ae/NFLNHD_13698/150.m3u8" target="_blank"&gt;http://linear-scope010.t.com/LIVE/2002/hls/ae/NFLNHD_13698/150.m3u8&lt;/A&gt;, keep original content (id 3313583396)&lt;/P&gt;

&lt;P&gt;Sample 8&lt;BR /&gt;
28 Aug 2017 20:45:22 [ERROR] snalarmd: &lt;STRONG&gt;Only one health check operation supported at a time&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Sample 9&lt;BR /&gt;
28 Aug 2017 14:50:20 [DEBUG] CSAP: &lt;STRONG&gt;traverseClientInitBufferAndUpdateState: size of client list is: 0&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Sample 10&lt;BR /&gt;
28 Aug 2017 20:50:07 [WARN ] AAA Manager: &lt;STRONG&gt;VMAP VAST ADS Plugin&lt;/STRONG&gt;: undefined variable in server URL "&lt;A href="http://69.134.155.15/adrouter/vmap/v1/scte?caid=tntdrama.com/TNTD0006071701018135&amp;amp;csid=stva_kindle_tab_vod&amp;amp;vcid=850ec238-bd28-319a-b6b7-1efcd689b9f2&amp;amp;adId=%7B%7B.CLIENT_URI.PARAM%5BadId%5D%7D%7D&amp;amp;idt=CHTR_ADM_STVA_IH_VMAP" target="_blank"&gt;http://69.134.155.15/adrouter/vmap/v1/scte?caid=tntdrama.com/TNTD0006071701018135&amp;amp;csid=stva_kindle_tab_vod&amp;amp;vcid=850ec238-bd28-319a-b6b7-1efcd689b9f2&amp;amp;adId={{.CLIENT_URI.PARAM[adId]}}&amp;amp;idt=CHTR_ADM_STVA_IH_VMAP&lt;/A&gt;" (id 3020264156)&lt;/P&gt;

&lt;P&gt;SAMPLE 11&lt;BR /&gt;
28 Aug 2017 15:04:45 [DEBUG] CSAP: &lt;STRONG&gt;traverseClientInitBufferAndUpdateState&lt;/STRONG&gt;: size of client list is: 0&lt;BR /&gt;
SAMPLE 12&lt;BR /&gt;
28 Aug 2017 13:25:29 [INFO ] snalarmd: &lt;STRONG&gt;NET-SNMP version 5.7.1 AgentX subagent connected&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;sample 12&lt;BR /&gt;
28 Aug 2017 15:32:16 [WARN ] ServerManager: &lt;STRONG&gt;Satellite 192.168.0.12 changed to use Other as Master.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;sample 13&lt;BR /&gt;
28 Aug 2017 15:32:16 [INFO ] ServerManager: &lt;STRONG&gt;Socket 31 is ready for 192.168.0.8:5551 set bufsize 67108864&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:31:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306090#M91896</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2020-09-29T15:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex to extract fields with different patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306091#M91897</link>
      <description>&lt;P&gt;Sorry, many of us cannot (or won't) download files from strangers.   If you edit your post and post the events in clear text, marked with the code button, then we may be able to help you more.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 22:22:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306091#M91897</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-28T22:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex to extract fields with different patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306092#M91898</link>
      <description>&lt;P&gt;@DalJeanis &lt;/P&gt;

&lt;P&gt;Thanks for letting me know,I have edited and pasted the sample events&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 22:36:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306092#M91898</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2017-08-28T22:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex to extract fields with different patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306093#M91899</link>
      <description>&lt;P&gt;You will have to write a couple and do the most specific ones first.  This is the as close as a general case can get:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "(?:[^:]*:){3}(?&amp;lt;details&amp;gt;[^:\(]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Aug 2017 00:53:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306093#M91899</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-08-29T00:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex to extract fields with different patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306094#M91900</link>
      <description>&lt;P&gt;I tried your rex but It is failing for sample events sample1,sample4,sample7&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2017 13:22:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306094#M91900</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2017-08-29T13:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex to extract fields with different patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306095#M91901</link>
      <description>&lt;P&gt;Yes, that is why I wrote exactly what I wrote.  Read it again.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 02:20:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306095#M91901</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-08-31T02:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex to extract fields with different patterns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306096#M91902</link>
      <description>&lt;P&gt;Here's the thing - yes, you can do it, but it's probably what they call in analytics "overfitting".  It's probably going to need constant tweaking.  &lt;/P&gt;

&lt;P&gt;Why do you want to leave out the session ID, the latency that was exceeded, the other specifics?&lt;/P&gt;

&lt;P&gt;In any case, here's the run-anywhere code that does these 13 samples.  Basically, it was easier to extract a little bit more and then &lt;CODE&gt;sed&lt;/CODE&gt; away the last bits. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval mydata="28 Aug 2017 22:33:49 [WARN ] http_srv: DONE 1023533 0.023082 404[Not Found] UNKNOWN-ID 24.211.252.82:58699 GET &lt;A href="http://mmdai-linear-west-02.ti.com/linear-scope010.ti.com/LIVE/1024/hls/ae/HGTV_HD/.swnd8bdfc1a-7d30-4662-b4a8-005056b278dcapple2apple/.rate_300800/index_v_300800_1.m3u8?nw=376521≺of=376521:twc_hls_live&amp;amp;mode=live&amp;amp;vdur=600&amp;amp;caid=HGTV_LIVE&amp;amp;csid=stva_android_ph_live&amp;amp;vcid=bc409d5d-7878-3ed8-920c-f136710ca195&amp;amp;z5=27545&amp;amp;ads=VAST_LIVE&amp;amp;tagset_name=VAST&amp;amp;_fw_lpu=http://linear-scope010.ti.com/LIVE/1024/hl" target="test_blank"&gt;http://mmdai-linear-west-02.ti.com/linear-scope010.ti.com/LIVE/1024/hls/ae/HGTV_HD/.swnd8bdfc1a-7d30-4662-b4a8-005056b278dcapple2apple/.rate_300800/index_v_300800_1.m3u8?nw=376521≺of=376521:twc_hls_live&amp;amp;mode=live&amp;amp;vdur=600&amp;amp;caid=HGTV_LIVE&amp;amp;csid=stva_android_ph_live&amp;amp;vcid=bc409d5d-7878-3ed8-920c-f136710ca195&amp;amp;z5=27545&amp;amp;ads=VAST_LIVE&amp;amp;tagset_name=VAST&amp;amp;_fw_lpu=http://linear-scope010.ti.com/LIVE/1024/hl&lt;/A&gt;. (id 19702873)!!!!28 Aug 2017 14:21:53 [WARN ] Content Generator: Client with unknown ID. Rejecting request (id 30299754) - uuid 5777d11e-c8d6-49ac-a5b2-fa163e11220e!!!!28 Aug 2017 20:21:53 [WARN ] http_cli: Origin latency exceeded threshold: 0.183154 seconds GET Status: 200[OK] Bytes: 10087 Origin URL: &lt;A href="http://aa.video.cdn.ch.com/LIVE/1027/hls/ae/VH1HD/3400.m3u8" target="test_blank"&gt;http://aa.video.cdn.ch.com/LIVE/1027/hls/ae/VH1HD/3400.m3u8&lt;/A&gt; refReqId 22804466 reqWait 0 (id 3314781656)!!!!28 Aug 2017 20:41:08 [WARN ] Content Generator: Media Time Line Broken. Reset time line for session 185d563a-dd54-4234-a38a-005056b20601 (id 1052189)!!!!28 Aug 2017 20:45:24 [WARN ] ManifestCache: Request Failed: add entry status 404 url &lt;A href="http://mmdai-vod-west-01.ti.com/TWCTV_vod/ooh/vod-9.ti.com/HLS_DRM/move1572890050300002/index.m3u8" target="test_blank"&gt;http://mmdai-vod-west-01.ti.com/TWCTV_vod/ooh/vod-9.ti.com/HLS_DRM/move1572890050300002/index.m3u8&lt;/A&gt; (id 3292891677)!!!!28 Aug 2017 14:46:30 [INFO ] ManifestCache: HLS STATS: requests=0 reqHit=0 reqMiss=0 urlHit=0 urlMiss=0 toServer=0!!!!28 Aug 2017 20:47:30 [WARN ] ManifestCache: Sequence number jumped back from 2069693 to 2069689 for &lt;A href="http://linear-scope010.t.com/LIVE/2002/hls/ae/NFLNHD_13698/150.m3u8" target="test_blank"&gt;http://linear-scope010.t.com/LIVE/2002/hls/ae/NFLNHD_13698/150.m3u8&lt;/A&gt;, keep original content (id 3313583396)!!!!28 Aug 2017 20:45:22 [ERROR] snalarmd: Only one health check operation supported at a time!!!!28 Aug 2017 14:50:20 [DEBUG] CSAP: traverseClientInitBufferAndUpdateState: size of client list is: 0!!!!28 Aug 2017 20:50:07 [WARN ] AAA Manager: VMAP VAST ADS Plugin: undefined variable in server URL \"http://69.134.155.15/adrouter/vmap/v1/scte?caid=tntdrama.com/TNTD0006071701018135&amp;amp;csid=stva_kindle_tab_vod&amp;amp;vcid=850ec238-bd28-319a-b6b7-1efcd689b9f2&amp;amp;adId={{.CLIENT_URI.PARAM[adId]}}&amp;amp;idt=CHTR_ADM_STVA_IH_VMAP\" (id 3020264156)!!!!28 Aug 2017 15:04:45 [DEBUG] CSAP: traverseClientInitBufferAndUpdateState: size of client list is: 0!!!!28 Aug 2017 13:25:29 [INFO ] snalarmd: NET-SNMP version 5.7.1 AgentX subagent connected!!!!28 Aug 2017 15:32:16 [WARN ] ServerManager: Satellite 192.168.0.12 changed to use Other as Master.!!!!28 Aug 2017 15:32:16 [INFO ] ServerManager: Socket 31 is ready for 192.168.0.8:5551 set bufsize 67108864"
| makemv delim="!!!!" mydata
| mvexpand mydata
| rename mydata as _raw
| rename COMMENT as "The above just inputs your test data."

| rename COMMENT as "Below is the requested code"
| rex "(?:[^:]*:){3} (?&amp;lt;details&amp;gt;DONE|Request Failed: [^\d]+|HLS STATS: [^:\(\[\n]+|Socket [^\n]+|[^:\(\[\n]+)"
| rex mode=sed field=details "s/[-0-9a-fA-F]{36} ?$//g s/for( http)?$//g"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Aug 2017 03:32:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-to-extract-fields-with-different-patterns/m-p/306096#M91902</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-31T03:32:23Z</dc:date>
    </item>
  </channel>
</rss>

