<?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 How to fetch values with regex which is inside double backslash in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/567472#M197760</link>
    <description>&lt;P&gt;Can anyone please help me to create the regex expression for the below log.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;nbsp;{\\n \\\"process\\\": \\\"get_input\\\",\\n \\\"totalProcessed\\\": \\\"0\\\",\\n \\\"SuccessfullyProcessed\\\": \\\"0\\\",\\n \\\"FailedToProcess\\\": \\\"0\\\",\\n \\\"FileName\\\": \\\"&lt;STRONG&gt;\\\&lt;/STRONG&gt;"\\n}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I created the regex for this as below, but for the '&lt;STRONG&gt;FileName&lt;/STRONG&gt;' I am getting '&lt;STRONG&gt;\n&lt;/STRONG&gt;'.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;nbsp;| rex field=_raw "process\W+(?&amp;lt;process&amp;gt;[\w\s]+)" | rex field=_raw "totalProcessed\W+(?&amp;lt;totalProcessed&amp;gt;[\w\s]+)"| rex field=_raw "SuccessfullyProcessed\W+(?&amp;lt;SuccessfullyProcessed&amp;gt;[\w\s]+)" | rex field=_raw "FileName\W+(?&amp;lt;FileName&amp;gt;[\w\s]+)" | rex field=_raw "FailedToProcess\W+(?&amp;lt;FailedToProcess&amp;gt;[\w\s]+)"&lt;/P&gt;&lt;P&gt;It seems some modification/rebuild the regex is needed.&amp;nbsp; Please help me on this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Sep 2021 17:07:33 GMT</pubDate>
    <dc:creator>rkishoreqa</dc:creator>
    <dc:date>2021-09-17T17:07:33Z</dc:date>
    <item>
      <title>How to fetch values with regex which is inside double backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/567472#M197760</link>
      <description>&lt;P&gt;Can anyone please help me to create the regex expression for the below log.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;nbsp;{\\n \\\"process\\\": \\\"get_input\\\",\\n \\\"totalProcessed\\\": \\\"0\\\",\\n \\\"SuccessfullyProcessed\\\": \\\"0\\\",\\n \\\"FailedToProcess\\\": \\\"0\\\",\\n \\\"FileName\\\": \\\"&lt;STRONG&gt;\\\&lt;/STRONG&gt;"\\n}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I created the regex for this as below, but for the '&lt;STRONG&gt;FileName&lt;/STRONG&gt;' I am getting '&lt;STRONG&gt;\n&lt;/STRONG&gt;'.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;nbsp;| rex field=_raw "process\W+(?&amp;lt;process&amp;gt;[\w\s]+)" | rex field=_raw "totalProcessed\W+(?&amp;lt;totalProcessed&amp;gt;[\w\s]+)"| rex field=_raw "SuccessfullyProcessed\W+(?&amp;lt;SuccessfullyProcessed&amp;gt;[\w\s]+)" | rex field=_raw "FileName\W+(?&amp;lt;FileName&amp;gt;[\w\s]+)" | rex field=_raw "FailedToProcess\W+(?&amp;lt;FailedToProcess&amp;gt;[\w\s]+)"&lt;/P&gt;&lt;P&gt;It seems some modification/rebuild the regex is needed.&amp;nbsp; Please help me on this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Sep 2021 17:07:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/567472#M197760</guid>
      <dc:creator>rkishoreqa</dc:creator>
      <dc:date>2021-09-17T17:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to fetch values with regex which is inside double backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/567482#M197765</link>
      <description>&lt;P&gt;What exactly are you trying to extract?&amp;nbsp; Do you want to keep or exclude the backslashes?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Sep 2021 18:28:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/567482#M197765</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-09-17T18:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to fetch values with regex which is inside double backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/567483#M197766</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225991"&gt;@rkishoreqa&lt;/a&gt;&amp;nbsp;Please use the below regex and let me know if it worked.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| regex field=_raw "process.*?\".*?\"(?P&amp;lt;process&amp;gt;\w+)"
| regex field=_raw "totalProcessed.*?\".*?\"(?P&amp;lt;totalProcessed&amp;gt;\d+)"
| regex field=_raw "SuccessfullyProcessed.*?\".*?\"(?P&amp;lt;SuccessfullyProcessed&amp;gt;\d+)"
| regex field=_raw "FailedToProcess.*?\".*?\"(?P&amp;lt;FailedToProcess&amp;gt;\d+)"
| regex field=_raw "FileName.*?\".*?\"(?P&amp;lt;FileName&amp;gt;.*?)\\"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Also, If this reply helps you, an upvote would be appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Sep 2021 18:40:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/567483#M197766</guid>
      <dc:creator>ashvinpandey</dc:creator>
      <dc:date>2021-09-17T18:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to fetch values with regex which is inside double backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/567649#M197837</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp; I need the below highlighted values.&amp;nbsp; The values from the key pair, but need to escape \\\.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;gt;&amp;nbsp;{\\n \\\"process\\\": \\\"&lt;U&gt;&lt;STRONG&gt;get_input&lt;/STRONG&gt;&lt;/U&gt;\\\",\\n \\\"totalProcessed\\\": \\\"&lt;U&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/U&gt;\\\",\\n \\\"SuccessfullyProcessed\\\": \\\"&lt;U&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/U&gt;\\\",\\n \\\"FailedToProcess\\\": \\\"&lt;STRONG&gt;&lt;U&gt;0&lt;/U&gt;\\\&lt;/STRONG&gt;",\\n \\\"FileName\\\": \\\"&lt;U&gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&lt;/U&gt;&lt;/SPAN&gt;&lt;STRONG&gt;\\\&lt;/STRONG&gt;&lt;SPAN&gt;"\\n}&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 12:23:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/567649#M197837</guid>
      <dc:creator>rkishoreqa</dc:creator>
      <dc:date>2021-09-20T12:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to fetch values with regex which is inside double backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/567676#M197848</link>
      <description>&lt;P&gt;Instead of modifying the regex, you need to fix the source data.&lt;/P&gt;&lt;P&gt;This could be done using a main script and a helper script.&lt;/P&gt;&lt;P&gt;I.e. each script could read in the input, and naturally strip out the escape characters in the output.&lt;/P&gt;&lt;P&gt;It looks like the current source data has been double-escaped, so " has become \" and then \\\". As such, you may need a second script to read in output from the first script, which can then be used as the source for ingest into Splunk.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 14:38:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/567676#M197848</guid>
      <dc:creator>ro_mc</dc:creator>
      <dc:date>2021-09-20T14:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to fetch values with regex which is inside double backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/568091#M197979</link>
      <description>&lt;P&gt;can anyone help me on this, waiting for resolution.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 16:18:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/568091#M197979</guid>
      <dc:creator>rkishoreqa</dc:creator>
      <dc:date>2021-09-22T16:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to fetch values with regex which is inside double backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/568098#M197982</link>
      <description>&lt;P&gt;Did you try the &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; commands offered by&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/199978"&gt;@ashvinpandey&lt;/a&gt;&amp;nbsp;?&amp;nbsp; If so, please reply to his answer with the results so we can try to resolve the issue.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 16:45:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/568098#M197982</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-09-22T16:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to fetch values with regex which is inside double backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/568106#M197983</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I am getting the below error when I tried with rex.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;gt; Error in 'rex' command: Encountered the following error while compiling the regex 'FileName:*?".*?"(?P&amp;lt;FileName&amp;gt;.*?)\': Regex: \ at end of pattern.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;After removing the prefix '\\' as below, then I am getting the 'FileName' as blank.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;nbsp;| rex field=_raw "FileName.*?\".*?\"(?P&amp;lt;FileName&amp;gt;.*?)"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 17:47:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/568106#M197983</guid>
      <dc:creator>rkishoreqa</dc:creator>
      <dc:date>2021-09-22T17:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to fetch values with regex which is inside double backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/568111#M197984</link>
      <description>&lt;P&gt;This is the expected result, as the filename is blank in the example provided.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| regex field=_raw "FileName.*?\".*?\"(?P&amp;lt;FileName&amp;gt;.*?)\\"&lt;/LI-CODE&gt;&lt;P&gt;To overcome the issue of the trailing backslashes, you can try either escaping the resolved backslash, so the last portion would read as&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(?P&amp;lt;FileName&amp;gt;.*?)\\\" or (?P&amp;lt;FileName&amp;gt;.*?)\\\\"&lt;/LI-CODE&gt;&lt;P&gt;An alternative is to avoid wildcard matches, such as matching on characters that aren't backslashes. The following should work, but it depends on how Splunk interprets the backslash character in this context:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(?P&amp;lt;FileName&amp;gt;[^\]*)"&lt;/LI-CODE&gt;&lt;P&gt;Finally, note that if the filenames themselves contain backslashes, this will break the regex, which is why it's better to remove them at the time of data ingest, allowing you to capture legitimate data without errors, as well as process any escaping that Splunk might (probably will) apply to the file path backslashes.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 18:09:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fetch-values-with-regex-which-is-inside-double-backslash/m-p/568111#M197984</guid>
      <dc:creator>ro_mc</dc:creator>
      <dc:date>2021-09-22T18:09:24Z</dc:date>
    </item>
  </channel>
</rss>

