<?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 backslash in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/help-with-backslash/m-p/549538#M155929</link>
    <description>&lt;P&gt;Have you tried replacing \\ with nothing and \" with ", then use spath to extract the field you want?&lt;/P&gt;</description>
    <pubDate>Tue, 27 Apr 2021 22:47:42 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-04-27T22:47:42Z</dc:date>
    <item>
      <title>help with backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-backslash/m-p/549537#M155928</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  \\\"person\\\":{\\\"name\\\":{\\\"firstName\\\":\\\"John\\\",\\\"lastName\\\":\\\"Doe\\\"},\\\"address\\\":{\\\"street\\\":\\\"100 Main Ave\\\",\\\"city\\\":\\\"Redwood City\\\",\\\"usState\\\":\\\"CA\\\",\\\"zipCode\\\":\\\"94061\\\",\\\"country\\\":\\\"United States\\\",\\\"phones\\\":[],\\\"emails\\\":[],\\\"addressLines\\\":[]},\\\"addresses\\\":[],\\\"phones\\\":[{\\\"phoneType\\\":\\\"Home\\\",\\\"phoneNumber\\\":\\\"6500000000\\\"}],\\\"email\\\":\\\"johndoe@gmail.com\\\",\\\"dateOfBirth\\\":\\\"1900/01/01\\\",\\\"nationalId\\\":\\\"100\\\",\\\"gender\\\":\\\"Male\\\"},\\\"credential\\\":{\\\"userName\\\":\\\"johndoe@gmail.com\\\",\\\"password\\\":\\\"Password\\\",\\\"securityQuestion\\\":\\\"Name of First Car?\\\",\\\"securityAnswer\\\":\\\"Volvo\\\"}\""
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help in getting email in splunk search query for above json which has blackslash in logs.&amp;nbsp; I have grabbed the nametag from very big log json using spath and i am calling that tag as "nametagforthisjson"&amp;nbsp; to simplify.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I tried this :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;| rex field=nametagforthisjson max_match=0 "\"email:\\\\\\\":\\\\\\\"(?&amp;lt;email&amp;gt;.*)\"(?=,)"
| table email&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I see email label printed but not value . So my regex is wrong. the email value&amp;nbsp;&lt;A href="mailto:johndoe@gmail.com" target="_blank" rel="noopener"&gt;johndoe@gmail.com&lt;/A&gt;&amp;nbsp;is for email name tag . So the value is until semicolon (,) . I am putting 7 blackslash.(2 backslash for 1 \&amp;nbsp; and 1 for ")&lt;BR /&gt;regex&amp;nbsp; query version&amp;nbsp;&lt;A href="https://regex101.com/r/8BevNW/1" target="_blank"&gt;https://regex101.com/r/8BevNW/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 22:50:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-backslash/m-p/549537#M155928</guid>
      <dc:creator>curiousvivek</dc:creator>
      <dc:date>2021-04-27T22:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: help with backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-backslash/m-p/549538#M155929</link>
      <description>&lt;P&gt;Have you tried replacing \\ with nothing and \" with ", then use spath to extract the field you want?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 22:47:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-backslash/m-p/549538#M155929</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-27T22:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: help with backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-backslash/m-p/549548#M155938</link>
      <description>&lt;P&gt;Thanks,I did this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval formattedjson = replace(nametagforthisjson,"\\\\", "")| table formattedjson&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;that but now i have json enclosed in double quotes&lt;/P&gt;&lt;P&gt;[see below]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"{
  "person": {
    "name": {
      "firstName": "John",
      "lastName": "Doe"
    },
    "address": {
      "street": "100 Main st",
      ...
      "phones": [
        
      ],
      "emails": [
        
      ],
      "addressLines": [
        
      ]
    },
    "addresses": [
      
    ],
    "phones": [
      {
        "phoneType": "Mobile",
        "phoneNumber": "65000000"
      }
    ],
    "email": "johdoe@gmail.com",
   ....
      
  }
  
}"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What should I do to remove this enclosing double quotes?&lt;BR /&gt;Once this is success, I want to do&lt;BR /&gt;eval email = json_extract('formattedjson',"person.email")&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 00:49:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-backslash/m-p/549548#M155938</guid>
      <dc:creator>curiousvivek</dc:creator>
      <dc:date>2021-04-28T00:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: help with backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-backslash/m-p/549574#M155948</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval formattedjson = trim(replace(nametagforthisjson,"\\\\", ""),"\"")
| spath field=formattedjson path=person.email output=email
| table formattedjson, email&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 28 Apr 2021 07:47:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-backslash/m-p/549574#M155948</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-28T07:47:48Z</dc:date>
    </item>
  </channel>
</rss>

