<?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 am I unable to extract cookie field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604820#M210351</link>
    <description>&lt;P&gt;Okay great!&lt;/P&gt;&lt;P&gt;However, I want to extract the "secureToken" bit from the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Set-Cookie: secureToken=11111112222233333445; Path=/; Secure; HttpOnly&lt;/LI-CODE&gt;&lt;P&gt;So I can add add it into the&amp;nbsp;&lt;EM&gt;interesting fields&lt;/EM&gt; section when searching in splunk&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jul 2022 17:16:07 GMT</pubDate>
    <dc:creator>jhilton90</dc:creator>
    <dc:date>2022-07-07T17:16:07Z</dc:date>
    <item>
      <title>Why am I unable to extract cookie field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604785#M210339</link>
      <description>&lt;P&gt;So I'm trying to extract a field called "secureToken=&lt;EM&gt;tokenvalue&lt;/EM&gt;" from our akamai logs. However when I try to extract the field, it gives me the following error message:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The extraction failed. If you are extracting multiple fields, try removing one or more fields. Start with extractions that are embedded within longer text strings.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I have attempted to manually edit the regex, but I have not a lot of experience with regex so any help would be greatly appreciated&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 17:01:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604785#M210339</guid>
      <dc:creator>jhilton90</dc:creator>
      <dc:date>2022-07-07T17:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to extract cookie field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604787#M210341</link>
      <description>&lt;P&gt;Please provide a couple of sample events.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 15:15:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604787#M210341</guid>
      <dc:creator>Azeemering</dc:creator>
      <dc:date>2022-07-07T15:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to extract cookie field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604795#M210345</link>
      <description>&lt;P&gt;Connection: close&lt;BR /&gt;Set-Cookie: secureToken=11111112222233333445; Path=/; Secure; HttpOnly&lt;BR /&gt;Server-Timing: cdn-cache; desc=MISS&lt;BR /&gt;Server-Timing: edge; dur=164&lt;BR /&gt;Server-Timing: origin; dur=158&lt;BR /&gt;Strict-Transport-Security: max-age=15768000&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 15:44:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604795#M210345</guid>
      <dc:creator>jhilton90</dc:creator>
      <dc:date>2022-07-07T15:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to extract cookie field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604798#M210346</link>
      <description>&lt;P&gt;This works as a basic example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="Connection: close
Set-Cookie: secureToken=11111112222233333445; Path=/; Secure; HttpOnly
Server-Timing: cdn-cache; desc=MISS
Server-Timing: edge; dur=164
Server-Timing: origin; dur=158
Strict-Transport-Security: max-age=15768000"
| rex "secureToken=(?&amp;lt;secureToken&amp;gt;\d+)"&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Azeemering_0-1657209938641.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/20436i2073A48725C78CA4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Azeemering_0-1657209938641.png" alt="Azeemering_0-1657209938641.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 16:05:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604798#M210346</guid>
      <dc:creator>Azeemering</dc:creator>
      <dc:date>2022-07-07T16:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to extract cookie field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604800#M210348</link>
      <description>&lt;P&gt;Hi thanks for the reply!&lt;/P&gt;&lt;P&gt;I just want to extract the secureToken field though.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 16:15:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604800#M210348</guid>
      <dc:creator>jhilton90</dc:creator>
      <dc:date>2022-07-07T16:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to extract cookie field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604801#M210349</link>
      <description>&lt;P&gt;I did exactly that in my reply with the part:&lt;/P&gt;&lt;PRE&gt;| rex "secureToken=(?&amp;lt;secureToken&amp;gt;\d+)"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 16:17:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604801#M210349</guid>
      <dc:creator>Azeemering</dc:creator>
      <dc:date>2022-07-07T16:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to extract cookie field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604811#M210350</link>
      <description>&lt;P&gt;To make it more clear how a regular expression field extractions works:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The rex syntax:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;rex field=&amp;lt;field&amp;gt; &amp;lt;PCRE named capture group&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The PCRE named capture group works the following way:&lt;/P&gt;&lt;P&gt;(?&amp;lt;name&amp;gt;regex)&lt;BR /&gt;The above expression captures the text matched by regex into the group&amp;nbsp;name.&lt;/P&gt;&lt;P&gt;If you don’t specify the field name, rex applies to _raw (which is the entire event).&lt;/P&gt;&lt;P&gt;Another example to make it more clear:&lt;/P&gt;&lt;P&gt;My example event is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Thu Jan 16 2018 00:15:06 mailsv1 sshd[5258]: Failed password for invalid user borisjohnson from 194.8.74.23 port 3626 ssh2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to extract the username from this:&lt;/P&gt;&lt;P&gt;I do that with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test sourcetype=demo_events
| rex user\s(?&amp;lt;username&amp;gt;\w+)\s&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will create the field name &lt;STRONG&gt;username&lt;/STRONG&gt; with the extracted value of &lt;STRONG&gt;borisjohnson&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;From regex101:&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Azeemering_0-1657211550703.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/20442i830AB8EF1F2DC60A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Azeemering_0-1657211550703.png" alt="Azeemering_0-1657211550703.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 16:32:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604811#M210350</guid>
      <dc:creator>Azeemering</dc:creator>
      <dc:date>2022-07-07T16:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to extract cookie field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604820#M210351</link>
      <description>&lt;P&gt;Okay great!&lt;/P&gt;&lt;P&gt;However, I want to extract the "secureToken" bit from the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Set-Cookie: secureToken=11111112222233333445; Path=/; Secure; HttpOnly&lt;/LI-CODE&gt;&lt;P&gt;So I can add add it into the&amp;nbsp;&lt;EM&gt;interesting fields&lt;/EM&gt; section when searching in splunk&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 17:16:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604820#M210351</guid>
      <dc:creator>jhilton90</dc:creator>
      <dc:date>2022-07-07T17:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to extract cookie field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604824#M210352</link>
      <description>&lt;P&gt;I really don't understand you? I just gave you the answer on a silver platter wrapped in a gold bow tie....&lt;/P&gt;&lt;P&gt;Do you actually understand my answer or are you trolling me?&lt;/P&gt;&lt;P&gt;The following spl command will extract the secureToken value and create a field called secureToken.&lt;/P&gt;&lt;PRE&gt;| rex "secureToken=(?&amp;lt;secureToken&amp;gt;\d+)"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;If you still don't understand I suggest you take the splunk course:&amp;nbsp;&lt;A href="https://www.splunk.com/en_us/training/courses/using-fields.html" target="_blank" rel="noopener"&gt;https://www.splunk.com/en_us/training/courses/using-fields.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 17:21:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604824#M210352</guid>
      <dc:creator>Azeemering</dc:creator>
      <dc:date>2022-07-07T17:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to extract cookie field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604894#M210371</link>
      <description>&lt;P&gt;I get it now don't worry, I was just a bit slow that is all!&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 08:51:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-extract-cookie-field/m-p/604894#M210371</guid>
      <dc:creator>jhilton90</dc:creator>
      <dc:date>2022-07-08T08:51:00Z</dc:date>
    </item>
  </channel>
</rss>

