<?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: How to spath or rename commands not extracting field / values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625107#M217296</link>
    <description>&lt;P&gt;I ended up using rex to get done what needed to be done.&amp;nbsp; Thanks for the help and guidance.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Dec 2022 16:12:35 GMT</pubDate>
    <dc:creator>bt149</dc:creator>
    <dc:date>2022-12-22T16:12:35Z</dc:date>
    <item>
      <title>How to spath or rename commands not extracting field / values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/624995#M217263</link>
      <description>&lt;P&gt;I have a field called properties.requestbody.&amp;nbsp; I would like to have this field broken out based on the field and values paired.&amp;nbsp; I've tried with spath and no luck.&amp;nbsp; I've used and am using rename to extract the field / values in other parts of the logged events.&amp;nbsp; Not having luck with this field.&amp;nbsp; I think it has to do with the quotes but I'm not certain.&amp;nbsp; Thanks as always for the help and guidance.&lt;/P&gt;
&lt;P&gt;"properties": {"requestbody": "{\"properties\":{\"description\":\"Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to diskAccesses, data leakage risks are reduced. Learn more about private links at: &lt;A href="https://aka.ms/disksprivatelinksdoc" target="_blank" rel="noopener"&gt;https://aka.ms/disksprivatelinksdoc&lt;/A&gt;. \",\"displayName\":\"COMP-015N-Disk access resources should use private link-AuditIfNotExists-BUL\",\"metadata\":\"******\",\"mode\":\"Indexed\",\"parameters\":\"******\",\"policyRule\":\"******\",\"policyType\":\"Custom\"}}"&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 15:03:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/624995#M217263</guid>
      <dc:creator>bt149</dc:creator>
      <dc:date>2022-12-21T15:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to spath or rename commands not extracting field / values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625000#M217264</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;spath&lt;/FONT&gt; command won't work with anything less than perfect JSON.&amp;nbsp; You can see this in the search log from the message "&lt;/P&gt;&lt;PRE&gt; WARN  SPathCommand [22744 phase_1] - Some events are not in XML or JSON format.  Fields will not be extracted from these events.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Adding &lt;FONT face="courier new,courier"&gt;{}&lt;/FONT&gt; around the event helped.&lt;/P&gt;&lt;P&gt;BTW, the &lt;FONT face="courier new,courier"&gt;rename&lt;/FONT&gt; command does not extract fields.&amp;nbsp; It merely changes the names of existing fields.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 15:24:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625000#M217264</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-12-21T15:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to spath or rename commands not extracting field / values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625004#M217265</link>
      <description>&lt;P&gt;Thanks for the reply.&amp;nbsp; I don't see the WARN you posted.&amp;nbsp; I'm not expecting the "rename" cmd to do field extractions.&lt;/P&gt;&lt;P&gt;In these logged events there is another set of fields called identity.authorization.action and identity.authorization.scop.&amp;nbsp; Using the rename command I then get&amp;nbsp; two fields w/ corresponding values.&lt;/P&gt;&lt;P&gt;| rename identity.authorization.* AS *&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;will produce action = "value"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;will produce scope = "value"&lt;/P&gt;&lt;P&gt;The difference is in the "identity" field the action and scope don't have quotes around the values where as the "properties.requestbody" field has values around all the fields and values.&amp;nbsp; Hope that makes sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 16:20:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625004#M217265</guid>
      <dc:creator>bt149</dc:creator>
      <dc:date>2022-12-21T16:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to spath or rename commands not extracting field / values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625018#M217267</link>
      <description>&lt;P&gt;The fields without quoted values will need a different regex.&amp;nbsp; How different depends on what values are expected and how Splunk can know where the value ends.&amp;nbsp; It may be possible to craft a regex that extracts either quoted or unquoted values, but that still means knowing where the value ends.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 20:21:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625018#M217267</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-12-21T20:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to spath or rename commands not extracting field / values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625020#M217268</link>
      <description>&lt;P&gt;The fields w/out quotes I have no issues with, just the one with the quotes.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 21:01:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625020#M217268</guid>
      <dc:creator>bt149</dc:creator>
      <dc:date>2022-12-21T21:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to spath or rename commands not extracting field / values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625035#M217274</link>
      <description>&lt;P&gt;I am a little confused. &amp;nbsp;Your actual events should look like this:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;{"properties": {"requestbody": "{\"properties\":{\"description\":\"Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to diskAccesses, data leakage risks are reduced. Learn more about private links at: &lt;A href="https://aka.ms/disksprivatelinksdoc" target="_blank" rel="noopener"&gt;https://aka.ms/disksprivatelinksdoc&lt;/A&gt;. \",\"displayName\":\"COMP-015N-Disk access resources should use private link-AuditIfNotExists-BUL\",\"metadata\":\"******\",\"mode\":\"Indexed\",\"parameters\":\"******\",\"policyRule\":\"******\",\"policyType\":\"Custom\"}}"}}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Is this about right? (If the raw data is not conformant JSON, you can try to make it conformant, then use spath.) Splunk already gives you a field properties.requestbody, with this value:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;{"properties":{"description":"Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to diskAccesses, data leakage risks are reduced. Learn more about private links at: &lt;A href="https://aka.ms/disksprivatelinksdoc" target="_blank" rel="noopener"&gt;https://aka.ms/disksprivatelinksdoc&lt;/A&gt;. ","displayName":"COMP-015N-Disk access resources should use private link-AuditIfNotExists-BUL","metadata":"******","mode":"Indexed","parameters":"******","policyRule":"******","policyType":"Custom"}}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If the above is correct, all you need to do is to run spath against this field, i.e.,&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;| spath input=properties.requestbody&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using this, your sample data gives&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="272.828125px" height="25px"&gt;properties.description&lt;/TD&gt;&lt;TD width="182.484375px" height="25px"&gt;properties.displayName&lt;/TD&gt;&lt;TD width="159.328125px" height="25px"&gt;properties.metadata&lt;/TD&gt;&lt;TD width="130.78125px" height="25px"&gt;properties.mode&lt;/TD&gt;&lt;TD width="172.78125px" height="25px"&gt;properties.parameters&lt;/TD&gt;&lt;TD width="55.609375px" height="25px"&gt;properties.policyRule&lt;/TD&gt;&lt;TD width="67.25px" height="25px"&gt;properties.policyType&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="272.828125px" height="267px"&gt;Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to diskAccesses, data leakage risks are reduced. Learn more about private links at: &lt;A href="https://aka.ms/disksprivatelinksdoc" target="_blank" rel="noopener"&gt;https://aka.ms/disksprivatelinksdoc&lt;/A&gt;.&lt;/TD&gt;&lt;TD width="182.484375px" height="267px"&gt;COMP-015N-Disk access resources should use private link-AuditIfNotExists-BUL&lt;/TD&gt;&lt;TD width="159.328125px" height="267px"&gt;******&lt;/TD&gt;&lt;TD width="130.78125px" height="267px"&gt;Indexed&lt;/TD&gt;&lt;TD width="172.78125px" height="267px"&gt;******&lt;/TD&gt;&lt;TD width="55.609375px" height="267px"&gt;******&lt;/TD&gt;&lt;TD width="67.25px" height="267px"&gt;Custom&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;Emulation&lt;/H3&gt;&lt;P&gt;This is the emulation I use to test&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;| makeresults
| fields - _time
| eval _raw = "{\"properties\": {\"requestbody\": \"{\\\"properties\\\":{\\\"description\\\":\\\"Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to diskAccesses, data leakage risks are reduced. Learn more about private links at: https://aka.ms/disksprivatelinksdoc. \\\",\\\"displayName\\\":\\\"COMP-015N-Disk access resources should use private link-AuditIfNotExists-BUL\\\",\\\"metadata\\\":\\\"******\\\",\\\"mode\\\":\\\"Indexed\\\",\\\"parameters\\\":\\\"******\\\",\\\"policyRule\\\":\\\"******\\\",\\\"policyType\\\":\\\"Custom\\\"}}\"}}"
``` data emulation above ```
| spath&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;</description>
      <pubDate>Thu, 22 Dec 2022 04:38:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625035#M217274</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-12-22T04:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to spath or rename commands not extracting field / values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625080#M217291</link>
      <description>&lt;P&gt;Don't be confused, my events look like how I posted and I believe that along w/ the quotes are causing the issue.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 12:38:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625080#M217291</guid>
      <dc:creator>bt149</dc:creator>
      <dc:date>2022-12-22T12:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to spath or rename commands not extracting field / values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625097#M217293</link>
      <description>&lt;P&gt;Splunk is fully capable of handling quotation marks in JSON events.&amp;nbsp; I believe we've demonstrated that.&amp;nbsp; The issue (as I see it) is the sample event is not valid JSON and the spath command will not process it.&amp;nbsp; AFAIK, none of the other JSON commands will work with invalid JSON, either.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 14:36:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625097#M217293</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-12-22T14:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to spath or rename commands not extracting field / values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625107#M217296</link>
      <description>&lt;P&gt;I ended up using rex to get done what needed to be done.&amp;nbsp; Thanks for the help and guidance.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 16:12:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625107#M217296</guid>
      <dc:creator>bt149</dc:creator>
      <dc:date>2022-12-22T16:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to spath or rename commands not extracting field / values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625147#M217312</link>
      <description>&lt;P&gt;Your original post says "&lt;SPAN&gt;I have a field called properties.requestbody." &amp;nbsp;That is only possible if the event is actually what I mended.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Now, if the original event is indeed missing the left open curly bracket, and missing two closing missing brackets, you can "mend" it by simply adding them.&lt;/SPAN&gt;&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;| eval _raw = replace(_raw, "(.*)", "{\1}}")
| spath
| spath input=properties.requestbody&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using SPL's builtin command would be much more robust than using rex to handle structured data.&lt;/P&gt;&lt;H3&gt;Emulation&lt;/H3&gt;&lt;P&gt;Here is an emulation to demonstrate:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| fields - _time
| eval _raw = "\"properties\": {\"requestbody\": \"{\\\"properties\\\":{\\\"description\\\":\\\"Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to diskAccesses, data leakage risks are reduced. Learn more about private links at: https://aka.ms/disksprivatelinksdoc. \\\",\\\"displayName\\\":\\\"COMP-015N-Disk access resources should use private link-AuditIfNotExists-BUL\\\",\\\"metadata\\\":\\\"******\\\",\\\"mode\\\":\\\"Indexed\\\",\\\"parameters\\\":\\\"******\\\",\\\"policyRule\\\":\\\"******\\\",\\\"policyType\\\":\\\"Custom\\\"}}\""
``` data emulation above ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It gives the exact string in your OP&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="100%"&gt;_raw&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="100%"&gt;&lt;SPAN&gt;"properties": {"requestbody": "{\"properties\":{\"description\":\"Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to diskAccesses, data leakage risks are reduced. Learn more about private links at: &lt;A href="https://aka.ms/disksprivatelinksdoc" target="_blank"&gt;https://aka.ms/disksprivatelinksdoc&lt;/A&gt;. \",\"displayName\":\"COMP-015N-Disk access resources should use private link-AuditIfNotExists-BUL\",\"metadata\":\"******\",\"mode\":\"Indexed\",\"parameters\":\"******\",\"policyRule\":\"******\",\"policyType\":\"Custom\"}}"&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Use replacement on it,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| fields - _time
| eval _raw = "\"properties\": {\"requestbody\": \"{\\\"properties\\\":{\\\"description\\\":\\\"Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to diskAccesses, data leakage risks are reduced. Learn more about private links at: https://aka.ms/disksprivatelinksdoc. \\\",\\\"displayName\\\":\\\"COMP-015N-Disk access resources should use private link-AuditIfNotExists-BUL\\\",\\\"metadata\\\":\\\"******\\\",\\\"mode\\\":\\\"Indexed\\\",\\\"parameters\\\":\\\"******\\\",\\\"policyRule\\\":\\\"******\\\",\\\"policyType\\\":\\\"Custom\\\"}}\""
``` data emulation above ```
| eval _raw = replace(_raw, "(.*)", "{\1}}")&lt;/LI-CODE&gt;&lt;P&gt;Then, you get the exact conformant JSON in my previous reply.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="100%"&gt;_raw&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="100%"&gt;&lt;SPAN&gt;{"properties": {"requestbody": "{\"properties\":{\"description\":\"Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to diskAccesses, data leakage risks are reduced. Learn more about private links at: &lt;A href="https://aka.ms/disksprivatelinksdoc" target="_blank"&gt;https://aka.ms/disksprivatelinksdoc&lt;/A&gt;. \",\"displayName\":\"COMP-015N-Disk access resources should use private link-AuditIfNotExists-BUL\",\"metadata\":\"******\",\"mode\":\"Indexed\",\"parameters\":\"******\",\"policyRule\":\"******\",\"policyType\":\"Custom\"}}"}}&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 23 Dec 2022 01:31:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-spath-or-rename-commands-not-extracting-field-values/m-p/625147#M217312</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-12-23T01:31:00Z</dc:date>
    </item>
  </channel>
</rss>

