<?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: Error in 'SearchParser': Mismatched ']' in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626212#M10893</link>
    <description>&lt;P&gt;We continue to make progress.&lt;/P&gt;&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; command merely extracts fields.&amp;nbsp; The extracted fields are added to the existing set of fields.&amp;nbsp; To control which fields are shown in the results, use the &lt;FONT face="courier new,courier"&gt;fields&lt;/FONT&gt; or &lt;FONT face="courier new,courier"&gt;table&lt;/FONT&gt; command.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;source="test.csv"
| rex field=raw_line "sblogin/(?&amp;lt;extracted_string&amp;gt;[^\"]+)"
| eval extracted_string=substr(extracted_string, 9)
| table extracted_string&lt;/LI-CODE&gt;&lt;P&gt;BTW, the &lt;FONT face="courier new,courier"&gt;substr&lt;/FONT&gt; function is looking for the 9th character in extracted_string.&amp;nbsp; In the example data, extracted_string is "username", which doesn't have 9 characters so &lt;FONT face="courier new,courier"&gt;substr&lt;/FONT&gt; returns nothing.&lt;/P&gt;</description>
    <pubDate>Fri, 06 Jan 2023 16:42:39 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2023-01-06T16:42:39Z</dc:date>
    <item>
      <title>Why the error in 'SearchParser': Mismatched ']' when using Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626165#M10886</link>
      <description>&lt;P&gt;Hi All, thanks for clicking on the question&lt;/P&gt;
&lt;P&gt;This search works fine in Linux using grep, but I can't get it to work in Splunk. Please can you help..&lt;/P&gt;
&lt;P&gt;I have imported a test.csv file that has many lines like the following&lt;/P&gt;
&lt;P&gt;[ERROR] 2023/01/05 16:53:05 [!] Get "&lt;A href="https://test.co.uk/sblogin/username" target="_blank" rel="noopener"&gt;https://test.co.uk/sblogin/username&lt;/A&gt;": context deadline exceeded (Client.Timeout exceeded while awaiting headers)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am simply just to trying to extract the username field after sblogin/ and nothing else after the "&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the query I have tried that gives the Error in 'SearchParser': Mismatched ']'&lt;/P&gt;
&lt;P&gt;source="test.csv"&amp;nbsp;| rex field=raw_line "sblogin/([^"]+)" | eval extracted_string=substr(extracted_string, 9)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 22:21:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626165#M10886</guid>
      <dc:creator>BongoNations</dc:creator>
      <dc:date>2023-01-06T22:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'SearchParser': Mismatched ']'</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626176#M10887</link>
      <description>&lt;P&gt;Quotation marks must be triple-escaped in the &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; command so they survive multiple layers of parsing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;source="test.csv" 
| rex field=raw_line "sblogin/([^\\\"]+)" 
| eval extracted_string=substr(extracted_string, 9)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 13:47:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626176#M10887</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-01-06T13:47:24Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'SearchParser': Mismatched ']'</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626186#M10888</link>
      <description>&lt;P&gt;In this case - one backslash is enough &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; The quote is within a character class so it's treated literarily.&lt;/P&gt;&lt;P&gt;But in other cases it could indeed need more escaping. (and yes, escaping regexes can be a pain).&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 14:04:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626186#M10888</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-01-06T14:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'SearchParser': Mismatched ']'</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626187#M10889</link>
      <description>&lt;P&gt;Thanks Rich I just tried that and got this error&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Error in 'rex' command: The regex 'sblogin/([^\"]+)' does not extract anything. It should specify at least one named group. Format: (?&amp;lt;name&amp;gt;...)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 14:05:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626187#M10889</guid>
      <dc:creator>BongoNations</dc:creator>
      <dc:date>2023-01-06T14:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'SearchParser': Mismatched ']'</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626194#M10890</link>
      <description>&lt;P&gt;Even with one backslash I get the same error&lt;/P&gt;&lt;P&gt;source="test.csv"&lt;BR /&gt;| rex field=raw_line "sblogin/([^\"]+)"&lt;BR /&gt;| eval extracted_string=substr(extracted_string, 9)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Error in 'rex' command: The regex 'sblogin/([^\"]+)' does not extract anything. It should specify at least one named group. Format: (?&amp;lt;name&amp;gt;...)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 14:30:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626194#M10890</guid>
      <dc:creator>BongoNations</dc:creator>
      <dc:date>2023-01-06T14:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'SearchParser': Mismatched ']'</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626196#M10891</link>
      <description>&lt;P&gt;We're making progress.&amp;nbsp; All that remains is to do as the message says and put a name to the capture group.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;source="test.csv" 
| rex field=raw_line "sblogin/(?&amp;lt;extracted_string&amp;gt;[^\"]+)" 
| eval extracted_string=substr(extracted_string, 9)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 06 Jan 2023 14:34:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626196#M10891</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-01-06T14:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'SearchParser': Mismatched ']'</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626203#M10892</link>
      <description>&lt;P&gt;Thanks I ran this query and it worked, but the output was basically everything, all text from the query lines. The usernames after sblogin/ were not specifically outputted on their own?&lt;/P&gt;&lt;P&gt;source="test.csv"&lt;BR /&gt;| rex field=raw_line "sblogin/(?&amp;lt;extracted_string&amp;gt;[^\"]+)"&lt;BR /&gt;| eval extracted_string=substr(extracted_string, 9)&lt;/P&gt;&lt;P&gt;I was hope to just see all the usernames and nothing else?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 15:16:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626203#M10892</guid>
      <dc:creator>BongoNations</dc:creator>
      <dc:date>2023-01-06T15:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'SearchParser': Mismatched ']'</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626212#M10893</link>
      <description>&lt;P&gt;We continue to make progress.&lt;/P&gt;&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; command merely extracts fields.&amp;nbsp; The extracted fields are added to the existing set of fields.&amp;nbsp; To control which fields are shown in the results, use the &lt;FONT face="courier new,courier"&gt;fields&lt;/FONT&gt; or &lt;FONT face="courier new,courier"&gt;table&lt;/FONT&gt; command.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;source="test.csv"
| rex field=raw_line "sblogin/(?&amp;lt;extracted_string&amp;gt;[^\"]+)"
| eval extracted_string=substr(extracted_string, 9)
| table extracted_string&lt;/LI-CODE&gt;&lt;P&gt;BTW, the &lt;FONT face="courier new,courier"&gt;substr&lt;/FONT&gt; function is looking for the 9th character in extracted_string.&amp;nbsp; In the example data, extracted_string is "username", which doesn't have 9 characters so &lt;FONT face="courier new,courier"&gt;substr&lt;/FONT&gt; returns nothing.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 16:42:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-the-error-in-SearchParser-Mismatched-when-using-Splunk/m-p/626212#M10893</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-01-06T16:42:39Z</dc:date>
    </item>
  </channel>
</rss>

