<?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: Multiple capture groups not capturing in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Multiple-capture-groups-not-capturing/m-p/669734#M229647</link>
    <description>&lt;P&gt;Assuming that the non-word characters are in the square brackets, you could try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="2023-11-25T21:18:54.244444  [  info      ]  I am a log message  request = GET /api/myendpoint    request_id = ff223452"
| rex "(?&amp;lt;timestamp&amp;gt;\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})\.\d+\s+\[\W*(?&amp;lt;loglevel&amp;gt;\w+)\W*\]\s+"&lt;/LI-CODE&gt;&lt;P&gt;but, ideally, you should ask the developers of the application to not use these characters in the first place.&lt;/P&gt;</description>
    <pubDate>Sun, 26 Nov 2023 11:31:51 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-11-26T11:31:51Z</dc:date>
    <item>
      <title>Multiple capture groups not capturing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multiple-capture-groups-not-capturing/m-p/669715#M229640</link>
      <description>&lt;P&gt;I have the following log structure:&lt;/P&gt;&lt;P&gt;&amp;nbsp; 2023-11-25T21:18:54.244444&amp;nbsp; [&amp;nbsp; info&amp;nbsp; &amp;nbsp; &amp;nbsp; ]&amp;nbsp; I am a log message&amp;nbsp; request = GET /api/myendpoint&amp;nbsp; &amp;nbsp; request_id = ff223452&lt;/P&gt;&lt;P&gt;I can capture the date and time (without the 244444 part) using:&lt;/P&gt;&lt;P&gt;rex field=myfield "(?&amp;lt;timestamp&amp;gt;\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})\.\d+"&lt;/P&gt;&lt;P&gt;and timestamp is properly captured.&lt;/P&gt;&lt;P&gt;But if I try to extend this and want to capture the log level as well with for example:&lt;/P&gt;&lt;P&gt;rex field=myfield "(?&amp;lt;timestamp&amp;gt;\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})\.\d+\s+\[\s*(?&amp;lt;loglevel&amp;gt;\w+)\s*\]\s+"&lt;/P&gt;&lt;P&gt;It didn't work; none of the timestamp nor the loglevel is captured.&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Sat, 25 Nov 2023 22:02:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multiple-capture-groups-not-capturing/m-p/669715#M229640</guid>
      <dc:creator>arielbintang</dc:creator>
      <dc:date>2023-11-25T22:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple capture groups not capturing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multiple-capture-groups-not-capturing/m-p/669716#M229641</link>
      <description>&lt;P&gt;You don't appear to be doing anything wrong, given the example you have shared.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="2023-11-25T21:18:54.244444  [  info      ]  I am a log message  request = GET /api/myendpoint    request_id = ff223452"
| rex "(?&amp;lt;timestamp&amp;gt;\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})\.\d+\s+\[\s*(?&amp;lt;loglevel&amp;gt;\w+)\s*\]\s+"&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 25 Nov 2023 22:52:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multiple-capture-groups-not-capturing/m-p/669716#M229641</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-11-25T22:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple capture groups not capturing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multiple-capture-groups-not-capturing/m-p/669729#M229645</link>
      <description>&lt;P&gt;Thanks for verifying! When I copy paste my log directly to the search box from the log message field and used your makeresults, I see that actually some of the spaces are actually&amp;nbsp;&amp;#27; character; do you know why perhaps its not shown in the results itself (and I have to copy paste)?&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2023 09:10:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multiple-capture-groups-not-capturing/m-p/669729#M229645</guid>
      <dc:creator>arielbintang</dc:creator>
      <dc:date>2023-11-26T09:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple capture groups not capturing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multiple-capture-groups-not-capturing/m-p/669734#M229647</link>
      <description>&lt;P&gt;Assuming that the non-word characters are in the square brackets, you could try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="2023-11-25T21:18:54.244444  [  info      ]  I am a log message  request = GET /api/myendpoint    request_id = ff223452"
| rex "(?&amp;lt;timestamp&amp;gt;\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})\.\d+\s+\[\W*(?&amp;lt;loglevel&amp;gt;\w+)\W*\]\s+"&lt;/LI-CODE&gt;&lt;P&gt;but, ideally, you should ask the developers of the application to not use these characters in the first place.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2023 11:31:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multiple-capture-groups-not-capturing/m-p/669734#M229647</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-11-26T11:31:51Z</dc:date>
    </item>
  </channel>
</rss>

