<?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: change column name with specified new column value in Splunk in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404188#M168695</link>
    <description>&lt;P&gt;Hi There,&lt;/P&gt;

&lt;P&gt;Can you expand on the problem a little more, such as what the data looks like and your expected outcome? At first glance from the above data my thoughts would be to use the CHART command by the field in question&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jun 2018 11:03:34 GMT</pubDate>
    <dc:creator>paulbannister</dc:creator>
    <dc:date>2018-06-26T11:03:34Z</dc:date>
    <item>
      <title>change column name with specified new column value in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404187#M168694</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am having correct value in current field and want to use that value as column name which is currently showing as A. Please help to solve this issue. For any other information please let me know.&lt;/P&gt;

&lt;P&gt;e.g if current is '06-24-2018' then in table header row should have column name as '06-24-2018'&lt;/P&gt;

&lt;P&gt;| base search&lt;BR /&gt;
| eval current = strftime(currentTime,"%m-%d-%Y")&lt;BR /&gt;
| eval  A  = if(P1C&amp;gt;0 OR P2C&amp;gt;0,"R",if(P3C&amp;gt;0,"Y","G"))&lt;BR /&gt;
| table "Project",A&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 10:46:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404187#M168694</guid>
      <dc:creator>vikas_baranwal</dc:creator>
      <dc:date>2018-06-26T10:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: change column name with specified new column value in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404188#M168695</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;

&lt;P&gt;Can you expand on the problem a little more, such as what the data looks like and your expected outcome? At first glance from the above data my thoughts would be to use the CHART command by the field in question&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 11:03:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404188#M168695</guid>
      <dc:creator>paulbannister</dc:creator>
      <dc:date>2018-06-26T11:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: change column name with specified new column value in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404189#M168696</link>
      <description>&lt;P&gt;I want to display column name with a date as an output of eval command and This date is also coming from a eval command output. &lt;BR /&gt;
Hope this information helps you to provide me solution. &lt;BR /&gt;
Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 11:14:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404189#M168696</guid>
      <dc:creator>vikas_baranwal</dc:creator>
      <dc:date>2018-06-26T11:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: change column name with specified new column value in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404190#M168697</link>
      <description>&lt;P&gt;@vikas_baranwal can you give the output table format. While it is clear that you need Date as table header, it is not clear what would each row look like. What is your current data. Sample data and current table and expected table format would be helpful.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 11:58:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404190#M168697</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-06-26T11:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: change column name with specified new column value in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404191#M168698</link>
      <description>&lt;P&gt;something like this - &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Use the value of one field as the name for a new field
In this example, use each value of the field counter to make a new field name. Assign to the new field the value of the Value field. See Field names under the Usage section.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;index=perfmon sourcetype=Perfmon* counter=* Value=* | eval {counter} = Value&lt;BR /&gt;
in your case |eval {current}=A&lt;BR /&gt;
Ref. &lt;A href="http://docs.splunk.com/Documentation/Splunk/7.1.1/SearchReference/Eval#4._Use_the_value_of_one_field_as_the_name_for_a_new_field"&gt;http://docs.splunk.com/Documentation/Splunk/7.1.1/SearchReference/Eval#4._Use_the_value_of_one_field_as_the_name_for_a_new_field&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;After running this you need to check your interesting field and add a last | stats values(06-15-2018) by "Project"&lt;BR /&gt;
assuming your currentTime value is 06-15-2018&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 11:58:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404191#M168698</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2018-06-26T11:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: change column name with specified new column value in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404192#M168699</link>
      <description>&lt;P&gt;My current SPL is like below in which currently weeks are hard -coded with values.&lt;/P&gt;

&lt;P&gt;| eval  "06-04-2018" = if(P1C&amp;gt;0 OR P2C&amp;gt;0,"R",if(P3C&amp;gt;0,"Y","G"))&lt;BR /&gt;
| eval "05-28-2018" = if(P1P1&amp;gt;0 OR P2P1&amp;gt;0,"R",if(P3P1&amp;gt;0,"Y","G"))&lt;BR /&gt;
| eval "05-21-2018" = if(P1P2&amp;gt;0 OR P2P2&amp;gt;0,"R",if(P3P2&amp;gt;0,"Y","G"))&lt;BR /&gt;
| eval "05-14-2018" = if(P1P3&amp;gt;0 OR P2P3&amp;gt;0,"R",if(P3P3&amp;gt;0,"Y","G"))&lt;BR /&gt;
| eval "05-07-2018" = if(P1P4&amp;gt;0 OR P2P4&amp;gt;0,"R",if(P3P4&amp;gt;0,"Y","G"))&lt;BR /&gt;
| table "Project","05-07-2018","05-14-2018","05-21-2018","05-28-2018"," 06-04-2018"&lt;BR /&gt;
| sort Project&lt;/P&gt;

&lt;P&gt;Using above query in SPL, data is in showing in below structure(Project field is already exist in the event data).&lt;/P&gt;

&lt;P&gt;[Screenshot attached ]&lt;/P&gt;

&lt;P&gt;Now I want to display my header column with week’s date. I modified query as advised by you but it did not work.&lt;/P&gt;

&lt;P&gt;| eval current = strftime(relative_time(now(),"@w1"),"%m-%d-%Y")&lt;BR /&gt;
| eval  A = if(P&lt;IMG src="https://ibb.co/gvEefT" alt="alt text" /&gt;1C&amp;gt;0 OR P2C&amp;gt;0,"R",if(P3C&amp;gt;0,"Y","G"))&lt;BR /&gt;
| eval {current} = A&lt;/P&gt;

&lt;P&gt;Thanks in advance for your help!&lt;BR /&gt;
alt text&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 10:33:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404192#M168699</guid>
      <dc:creator>vikas_baranwal</dc:creator>
      <dc:date>2018-06-27T10:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: change column name with specified new column value in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404193#M168700</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Perhaps I am not getting your use case or I am not able to explain. At any rate I have written a query on the default _audit index , so that you can run the query as it is (select last 24 hours)&lt;BR /&gt;
index="_audit" | eval current = strftime(_time,"%m-%d-%Y") | eval A = if(action="search","search","no search") | eval {current} = A |table 06-27-2018&lt;/P&gt;

&lt;P&gt;Now, the 06-27-2018 needs to be replaced by current day -1, so if you run this on 30th June you would write something like - index="_audit" | eval current = strftime(_time,"%m-%d-%Y") | eval A = if(action="search","search","no search") | eval {current} = A |table 06-29-2018&lt;/P&gt;

&lt;P&gt;Is this something like what you need?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:12:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/change-column-name-with-specified-new-column-value-in-Splunk/m-p/404193#M168700</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2020-09-29T20:12:40Z</dc:date>
    </item>
  </channel>
</rss>

