<?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: Splunk labels in table format in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569745#M198574</link>
    <description>&lt;P&gt;i will be unable to add the transforms (no access to the splunk infra).&amp;nbsp; Therefore, i am looking for the search time commands. Any direction to start will be helpful.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Oct 2021 17:36:24 GMT</pubDate>
    <dc:creator>vadlamudi</dc:creator>
    <dc:date>2021-10-05T17:36:24Z</dc:date>
    <item>
      <title>Splunk labels in table format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569628#M198535</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Log event:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[ 2021-02-04 23:14:28.925 SingleApp log:158] 200 GET /apache/proxy/user/1123123/qsdddqwedqewdqwdqwd/api (@1.1.1.1.1) 0.98ms&lt;BR /&gt;k8s_label = app=jupyterhub k8s_label = component=server k8s_label = entity_type=jupyter-lab k8s_label = heritage=jupyterhub k8s_label = identity_name=namespace k8s_label = notebook_id=1123324234 k8s_label = notebook_name=learningpython.iypnb k8s_label = project_id=123 k8s_label = sdr.appname=notebooks k8s_label = user=mattparker k8s_label = user_id=1123234 k8s_label = zone=us-east-2b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to achieve the&lt;EM&gt; k8s_labels&lt;/EM&gt; in table format in splunk but however, when i us the below query i am getting an error.&amp;nbsp; any help would be appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Query:&lt;/P&gt;&lt;P&gt;index=&amp;lt;index_name&amp;gt; sourcetype=&amp;lt;sourcetype_Name&amp;gt; 1123123 | table k8s_label="user_id=1123234",k8s_label="mattparker"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;Error in 'table' command: Invalid argument: 'k8s_label=user_id=1123234'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 23:38:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569628#M198535</guid>
      <dc:creator>vadlamudi</dc:creator>
      <dc:date>2021-10-04T23:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk labels in table format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569633#M198539</link>
      <description>&lt;P class="lia-align-left"&gt;To be honest - I have no idea what you're trying to do.&lt;/P&gt;&lt;P class="lia-align-left"&gt;Firstly, regardless of what you want, your search doesn't make much sense. You add conditions in the search, you table with the table, but you don't filter with the table. So if you want to restrict your results (return only a subset of maching events), you add the condition to the search in front of the pipe character. To the table command you only give names of fields which are to be put into the table.&lt;/P&gt;&lt;P class="lia-align-left"&gt;But there's more - I don't understand what you're trying to do with your data. You have several chunks of data there with the same "name" and different values which are key/value pairs. Are they being parsed into fields? Or maybe you want to parse them? If so, you have to let splunk know how to do so (and table command is definitely not the way to go).&lt;/P&gt;&lt;P class="lia-align-left"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 04:11:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569633#M198539</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-10-05T04:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk labels in table format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569723#M198565</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp; sorry for the confusion.&amp;nbsp; What i trying to achieve here is that something like below in tabular format. i am trying to put the key value pairs in tabular format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;notebook_name&amp;nbsp;&amp;nbsp; learningpython.iypnb&lt;/P&gt;&lt;P&gt;project_id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123&lt;/P&gt;&lt;P&gt;user&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mattparker&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 16:05:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569723#M198565</guid>
      <dc:creator>vadlamudi</dc:creator>
      <dc:date>2021-10-05T16:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk labels in table format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569733#M198568</link>
      <description>&lt;P&gt;OK. So in other words you want to parse out key/value pairs from each "entity" given as value to k8s_label, right?&lt;/P&gt;&lt;P&gt;It would be easiest if you added a proper entry into props.conf and transforms.conf to create fields dynamicaly.&lt;/P&gt;&lt;P&gt;Otherwise, just running search-time commands, it will be complicated. Probably possible, but complicated.&lt;/P&gt;&lt;P&gt;Unless the set of field and their order is known and more-or-less constant.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 16:57:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569733#M198568</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-10-05T16:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk labels in table format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569745#M198574</link>
      <description>&lt;P&gt;i will be unable to add the transforms (no access to the splunk infra).&amp;nbsp; Therefore, i am looking for the search time commands. Any direction to start will be helpful.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 17:36:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569745#M198574</guid>
      <dc:creator>vadlamudi</dc:creator>
      <dc:date>2021-10-05T17:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk labels in table format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569755#M198579</link>
      <description>&lt;P&gt;Can you provide a sample output (the table that you want your Splunk search to return) based on your sample data? A search time transformation of the data could be possible but would need to know the exact output to attempt any solution.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 18:21:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569755#M198579</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2021-10-05T18:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk labels in table format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569761#M198581</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt;&amp;nbsp;&amp;nbsp; Below is the expected table format from the key value pairs.&lt;/P&gt;&lt;P&gt;Log event:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[ 2021-02-04 23:14:28.925 SingleApp log:158] 200 GET /apache/proxy/user/1123123/qsdddqwedqewdqwdqwd/api (@1.1.1.1.1) 0.98ms&lt;BR /&gt;k8s_label = app=jupyterhub k8s_label = component=server k8s_label = entity_type=jupyter-lab k8s_label = heritage=jupyterhub k8s_label = identity_name=namespace k8s_label = notebook_id=1123324234 k8s_label = notebook_name=learningpython.iypnb k8s_label = project_id=123 k8s_label = sdr.appname=notebooks k8s_label = user=mattparker k8s_label = user_id=1123234 k8s_label = zone=us-east-2b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected Ouptut:&lt;/P&gt;&lt;P&gt;The k8s_labels from the log event should be in table format.&amp;nbsp; below is the sample output of k8s_label.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;notebook_name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; earningpython.iypnb&lt;/P&gt;&lt;P&gt;project_id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123&lt;/P&gt;&lt;P&gt;user&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mattparker&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 18:34:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569761#M198581</guid>
      <dc:creator>vadlamudi</dc:creator>
      <dc:date>2021-10-05T18:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk labels in table format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569768#M198583</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=yourIndex sourcetype=yourSourcetype ..other search criteria
| table _raw
| rex field=_raw mode=sed "s/k8s_label\s*\=\s*//g" | extract&lt;/LI-CODE&gt;&lt;P&gt;You're basically getting rid of repeating phrase "k8s_label = " as it's interfering with automatic field extraction. The output will contains field names like app, component, entitiy_type&amp;nbsp; etc, with corresponding values. See if that works for you.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 19:04:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569768#M198583</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2021-10-05T19:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk labels in table format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569773#M198585</link>
      <description>&lt;P&gt;Thank you for the query &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt; . When i run the query, i am getting the below output.&amp;nbsp; It is not extracting the K8s_labels.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[ 2021-02-04 23:14:28.925 SingleApp log:158] 200 GET /apache/proxy/user/1123123/qsdddqwedqewdqwdqwd/api (@1.1.1.1.1) 0.98ms&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 19:26:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569773#M198585</guid>
      <dc:creator>vadlamudi</dc:creator>
      <dc:date>2021-10-05T19:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk labels in table format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569831#M198606</link>
      <description>&lt;P&gt;You can add the extractions from the GUI (the settings you add there land in the props.conf and transforms.conf of the search app). But in search time...&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex max_match=0 "k8s_label\s*=\s*(?&amp;lt;myprefix&amp;gt;[^=]+)=(?&amp;lt;mysuffix&amp;gt;\S+)" 
| eval myvars=mvzip(myprefix,mysuffix)
| mvexpand myvars 
| rex field=myvars "(?&amp;lt;mykey&amp;gt;[^,]+),(?&amp;lt;myvalue&amp;gt;.*)"
| eval {mykey}=myvalue 
| fields - mykey myvalue myprefix mysuffix myvars
| stats values(*) by _raw _time 
| foreach values(*)
    [ rename &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; as &amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt; ]&lt;/LI-CODE&gt;&lt;P&gt;Ugly like hell but might just work &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 06:11:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-labels-in-table-format/m-p/569831#M198606</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-10-06T06:11:00Z</dc:date>
    </item>
  </channel>
</rss>

