<?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 Need help in extraction and creating table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extraction-and-creating-table/m-p/618833#M215071</link>
    <description>&lt;P&gt;&amp;nbsp;Below query is in string text format need to separate each field and create a table with all columns for operator , register , store , timestamp, associate_id, audit_result&lt;/P&gt;&lt;P&gt;log: {“timeMillis”:“166665", “timestamp”:“2022-10-16", “level”:“INFO”,“logger”:“com.abc”, “message”:“Business Key=null, Publishing status: [ client_req_id dc366, event_date 2022-10-16, event_name EXIT ], message {“receipts”:[{“id”:“150”, “date”:“2022-10-24”, “store”:“99”, “operator”:“48”, “register”:“48”,“status”:“pass”,}], “result”: {“date”:“2022-10-16",“store”:“99",“associate_id”:“92",“result”:“Pass”,“failure_reason”:null,“scanned_items”:1, “items_found”:[],“items_not_found”:[]}}”&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried query as spath input= , path= , output= | table id, operator , register, store , timestamp but dont work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 30 Oct 2022 08:34:19 GMT</pubDate>
    <dc:creator>monicateja</dc:creator>
    <dc:date>2022-10-30T08:34:19Z</dc:date>
    <item>
      <title>Need help in extraction and creating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extraction-and-creating-table/m-p/618833#M215071</link>
      <description>&lt;P&gt;&amp;nbsp;Below query is in string text format need to separate each field and create a table with all columns for operator , register , store , timestamp, associate_id, audit_result&lt;/P&gt;&lt;P&gt;log: {“timeMillis”:“166665", “timestamp”:“2022-10-16", “level”:“INFO”,“logger”:“com.abc”, “message”:“Business Key=null, Publishing status: [ client_req_id dc366, event_date 2022-10-16, event_name EXIT ], message {“receipts”:[{“id”:“150”, “date”:“2022-10-24”, “store”:“99”, “operator”:“48”, “register”:“48”,“status”:“pass”,}], “result”: {“date”:“2022-10-16",“store”:“99",“associate_id”:“92",“result”:“Pass”,“failure_reason”:null,“scanned_items”:1, “items_found”:[],“items_not_found”:[]}}”&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried query as spath input= , path= , output= | table id, operator , register, store , timestamp but dont work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Oct 2022 08:34:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extraction-and-creating-table/m-p/618833#M215071</guid>
      <dc:creator>monicateja</dc:creator>
      <dc:date>2022-10-30T08:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in extraction and creating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extraction-and-creating-table/m-p/618834#M215072</link>
      <description>&lt;P&gt;Given that the string you shared is not valid JSON, it is not surprising that spath didn't work.&lt;/P&gt;&lt;P&gt;Assuming that the double quotes are supposed to be real double quotes (not pretty format versions), you could try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\"operator\":\"(?&amp;lt;operator&amp;gt;[^\"]+)\""
| rex "\"register\":\"(?&amp;lt;register&amp;gt;[^\"]+)\""
| rex "\"store\":\"(?&amp;lt;store&amp;gt;[^\"]+)\""
| rex "\"timestamp\":\"(?&amp;lt;timestamp&amp;gt;[^\"]+)\""
| rex "\"associate_id\":\"(?&amp;lt;associate_id&amp;gt;[^\"]+)\""
| rex "\"audit_result\":\"(?&amp;lt;audit_result&amp;gt;[^\"]+)\""&lt;/LI-CODE&gt;&lt;P&gt;Note that audit_result does not exist in your shared example.&lt;/P&gt;&lt;P&gt;In future, it would be better to share your event examples (taken from the _raw field) in a code block using the &amp;lt;/&amp;gt; button as I have done with the sample code, as this eliminates pretty formatting conversions.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Oct 2022 09:09:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extraction-and-creating-table/m-p/618834#M215072</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-10-30T09:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in extraction and creating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extraction-and-creating-table/m-p/618889#M215091</link>
      <description>&lt;P&gt;Similar to your other question,&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Splunk-Search/Regex-search/m-p/618859#M215078," target="_blank" rel="noopener"&gt;https://community.splunk.com/t5/Splunk-Search/Regex-search/m-p/618859#M215078,&lt;/A&gt;&amp;nbsp;I seriously suspect that your illustrated data is not faithful to the original format. &amp;nbsp;For example, inside the receipts block, the last comma was either extra ('&amp;nbsp;&lt;SPAN&gt;"status":"pass",}] ' should be ' "status":"pass"}] ')&lt;/SPAN&gt;, or some additional fields are being omitted. (And that, again, is in addition to the inconsistent use of quotation mark character.) &amp;nbsp;If I correct the quotation mark character as well as the extra comma, the second "message" part of the data is conformant JSON. &amp;nbsp;You should not attempt to use regex for such structured data. &amp;nbsp;Use built-in command &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath" target="_blank" rel="noopener"&gt;spath&lt;/A&gt;&amp;nbsp;that takes care of all the complexities.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "message (?&amp;lt;message&amp;gt;{.+}})"
| spath input=message
| fields - receipts{}.* ``` receipts are multivalue. handle separately ```
| spath input=message path=receipts{}
| mvexpand receipts{}
| spath input=receipts{}
| fields - message receipts{} result _time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This should give you something like&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="54.875px" height="25px"&gt;date&lt;/TD&gt;&lt;TD width="40px" height="25px"&gt;id&lt;/TD&gt;&lt;TD width="73.84375px" height="25px"&gt;operator&lt;/TD&gt;&lt;TD width="66.375px" height="25px"&gt;register&lt;/TD&gt;&lt;TD width="146.703125px" height="25px"&gt;result.associate_id&lt;/TD&gt;&lt;TD width="87.6875px" height="25px"&gt;result.date&lt;/TD&gt;&lt;TD width="158.40625px" height="25px"&gt;result.failure_reason&lt;/TD&gt;&lt;TD width="96.15625px" height="25px"&gt;result.result&lt;/TD&gt;&lt;TD width="165.578125px" height="25px"&gt;result.scanned_items&lt;/TD&gt;&lt;TD width="92.515625px" height="25px"&gt;result.store&lt;/TD&gt;&lt;TD width="55.921875px" height="25px"&gt;status&lt;/TD&gt;&lt;TD width="48.296875px" height="25px"&gt;store&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="54.875px" height="47px"&gt;2022-10-24&lt;/TD&gt;&lt;TD width="40px" height="47px"&gt;150&lt;/TD&gt;&lt;TD width="73.84375px" height="47px"&gt;48&lt;/TD&gt;&lt;TD width="66.375px" height="47px"&gt;48&lt;/TD&gt;&lt;TD width="146.703125px" height="47px"&gt;92&lt;/TD&gt;&lt;TD width="87.6875px" height="47px"&gt;2022-10-16&lt;/TD&gt;&lt;TD width="158.40625px" height="47px"&gt;null&lt;/TD&gt;&lt;TD width="96.15625px" height="47px"&gt;Pass&lt;/TD&gt;&lt;TD width="165.578125px" height="47px"&gt;1&lt;/TD&gt;&lt;TD width="92.515625px" height="47px"&gt;99&lt;/TD&gt;&lt;TD width="55.921875px" height="47px"&gt;pass&lt;/TD&gt;&lt;TD width="48.296875px" height="47px"&gt;99&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 31 Oct 2022 08:59:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extraction-and-creating-table/m-p/618889#M215091</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-10-31T08:59:30Z</dc:date>
    </item>
  </channel>
</rss>

