<?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: Extracting field name containing as table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609240#M211854</link>
    <description>&lt;P&gt;It's not clear what you're trying to achieve with that rex. &amp;nbsp;If you need help to put the conformant JSON part of your log into a field that spath can operate on, here are some suggestions.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Go back to your developers and ask them to do something helpful, namely, place the JSON part in a key-value pair that Splunk can easily handle, e.g.,&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2021-11-25 00:48:02 something unimportant conformant='{"prefix:field1":"ABC","TxnMsg":{"prefix:field2":"XYZ","prefix:field3":123}}' something else unimportant​&lt;/LI-CODE&gt;&lt;P&gt;Then, you can use &lt;FONT face="andale mono,times"&gt;spath input=conformant&lt;/FONT&gt;. &amp;nbsp;This is the best option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Post some sample full log (anonymized) for others to help analyze and determine how to get the conformant part.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Aug 2022 03:54:28 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2022-08-12T03:54:28Z</dc:date>
    <item>
      <title>How to extract field name containing as table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609225#M211841</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;
&lt;P&gt;I have data like below.&amp;nbsp; How do I extract the field names like&amp;nbsp;prefix:field1,&amp;nbsp;prefix:field2,&amp;nbsp;prefix:field3 in tablular fashion.&amp;nbsp; Extract all those fields containing the word, "prefix:" in it.&lt;/P&gt;
&lt;P&gt;"prefix:field1":"value1","prefix:field2":value2,"prefix:field3":value3,&lt;/P&gt;
&lt;P&gt;Expect result&lt;/P&gt;
&lt;P&gt;prefix:field1&lt;/P&gt;
&lt;P&gt;prefix:field2&lt;/P&gt;
&lt;P&gt;prefix:field3&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 15:07:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609225#M211841</guid>
      <dc:creator>msg4sunil</dc:creator>
      <dc:date>2022-08-12T15:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting field name containing as table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609227#M211843</link>
      <description>&lt;P&gt;Use &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Extract" target="_blank" rel="noopener"&gt;extract&lt;/A&gt;, (aka kv) e.g.,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| kv pairdelim=",", kvdelim=":"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You get&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;_raw&lt;/TD&gt;&lt;TD&gt;prefix_field1&lt;/TD&gt;&lt;TD&gt;prefix_field2&lt;/TD&gt;&lt;TD&gt;prefix_field3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;"prefix:field1":"value1","prefix:field2":value2,"prefix:field3":"value3"&lt;/TD&gt;&lt;TD&gt;value1&lt;/TD&gt;&lt;TD&gt;value2&lt;/TD&gt;&lt;TD&gt;value3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Is this what you need?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 01:58:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609227#M211843</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-08-12T01:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting field name containing as table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609228#M211844</link>
      <description>&lt;P&gt;Its not always in this pattern(&lt;SPAN&gt;"prefix:field1":"value1","prefix:field2":value2,"prefix:field3":value3,&lt;/SPAN&gt;) and rather be&amp;nbsp; more complex structure as well(could be "prefix:field1":"ABC","TxnMsg":{"prefix:field2":XYZ,"prefix:field3":123},).&amp;nbsp; Is there any other way?&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 02:04:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609228#M211844</guid>
      <dc:creator>msg4sunil</dc:creator>
      <dc:date>2022-08-12T02:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting field name containing as table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609230#M211846</link>
      <description>&lt;P&gt;The example you give looks like a fragment of a JSON object. &amp;nbsp;Is your raw data or a part of that data conformant JSON? &amp;nbsp;If so, use&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath" target="_blank" rel="noopener"&gt;spath&lt;/A&gt;&amp;nbsp;instead. &amp;nbsp;For example, if _raw is&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{
    "prefix:field1": "ABC",
    "TxnMsg": {
        "prefix:field2": "XYZ",
        "prefix:field3": 123
    }
}&lt;/PRE&gt;&lt;P&gt;spath gives&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;TxnMsg.prefix:field2&lt;/TD&gt;&lt;TD&gt;TxnMsg.prefix:field3&lt;/TD&gt;&lt;TD&gt;_raw&lt;/TD&gt;&lt;TD&gt;prefix:field1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;{"prefix:field1":"ABC","TxnMsg":{"prefix:field2":"XYZ","prefix:field3":123}}&lt;/TD&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 12 Aug 2022 03:04:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609230#M211846</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-08-12T03:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting field name containing as table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609233#M211849</link>
      <description>&lt;P&gt;Yes, part of the data is JSON and not the entire _raw. Isn't there a way to look for String matching&amp;nbsp;&lt;SPAN&gt;"prefix:.*" criteria&amp;nbsp;and extract the complete matched string? thank you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 03:12:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609233#M211849</guid>
      <dc:creator>msg4sunil</dc:creator>
      <dc:date>2022-08-12T03:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting field name containing as table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609235#M211851</link>
      <description>&lt;P&gt;You should focus on extracting that conformant part into its own field. &amp;nbsp;Suppose you have a field &lt;FONT face="andale mono,times"&gt;data&lt;/FONT&gt; &amp;nbsp;that contains conformant JSON, you can do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath input=data&lt;/LI-CODE&gt;&lt;P&gt;Trying to manipulate structured data as text is labored and unreliable.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 03:21:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609235#M211851</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-08-12T03:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting field name containing as table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609236#M211852</link>
      <description>&lt;P class="lia-align-left"&gt;&amp;nbsp;I was trying the below, but its not helping much as in its not extracting all the data. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P class="lia-align-left"&gt;*| rex field=_raw "&lt;SPAN&gt;prefix&lt;/SPAN&gt;:(?&amp;lt;from&amp;gt;\w+)" | dedup from | table from&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 03:38:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609236#M211852</guid>
      <dc:creator>msg4sunil</dc:creator>
      <dc:date>2022-08-12T03:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting field name containing as table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609240#M211854</link>
      <description>&lt;P&gt;It's not clear what you're trying to achieve with that rex. &amp;nbsp;If you need help to put the conformant JSON part of your log into a field that spath can operate on, here are some suggestions.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Go back to your developers and ask them to do something helpful, namely, place the JSON part in a key-value pair that Splunk can easily handle, e.g.,&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2021-11-25 00:48:02 something unimportant conformant='{"prefix:field1":"ABC","TxnMsg":{"prefix:field2":"XYZ","prefix:field3":123}}' something else unimportant​&lt;/LI-CODE&gt;&lt;P&gt;Then, you can use &lt;FONT face="andale mono,times"&gt;spath input=conformant&lt;/FONT&gt;. &amp;nbsp;This is the best option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Post some sample full log (anonymized) for others to help analyze and determine how to get the conformant part.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 03:54:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609240#M211854</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-08-12T03:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting field name containing as table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609241#M211855</link>
      <description>&lt;P&gt;Thank you.&amp;nbsp; In the above case, what would be the exact command to extract&amp;nbsp;prefix:field1,&amp;nbsp;prefix:field2,&amp;nbsp;prefix:field3 in tabular fashion .&amp;nbsp; What needs to be added to the below?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;spath input=conformant&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;thank you&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 04:35:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609241#M211855</guid>
      <dc:creator>msg4sunil</dc:creator>
      <dc:date>2022-08-12T04:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting field name containing as table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609244#M211856</link>
      <description>&lt;P&gt;In that path, you need to go back to the developers who produced the logs, ask them to place the JSON part in a key-pair structure as exemplified in my comment. (Or maybe they already did and your data already contained that JSON field?)&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 05:10:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-name-containing-as-table/m-p/609244#M211856</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-08-12T05:10:34Z</dc:date>
    </item>
  </channel>
</rss>

