<?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 How do I rename column name with javascript? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-rename-column-name-with-javascript/m-p/413309#M172747</link>
    <description>&lt;P&gt;I have a search with generate dynamic the column name with pattern "Month - Year" eg. "October - 2018" "November - 2018" "December - 2018". However, splunk orders the column by alphabet. So, I have an idea to convert them to unix time and then convert the column name back with javascript. How do I rename column name with javascript?&lt;/P&gt;</description>
    <pubDate>Sat, 02 Mar 2019 12:26:14 GMT</pubDate>
    <dc:creator>karn</dc:creator>
    <dc:date>2019-03-02T12:26:14Z</dc:date>
    <item>
      <title>How do I rename column name with javascript?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-rename-column-name-with-javascript/m-p/413309#M172747</link>
      <description>&lt;P&gt;I have a search with generate dynamic the column name with pattern "Month - Year" eg. "October - 2018" "November - 2018" "December - 2018". However, splunk orders the column by alphabet. So, I have an idea to convert them to unix time and then convert the column name back with javascript. How do I rename column name with javascript?&lt;/P&gt;</description>
      <pubDate>Sat, 02 Mar 2019 12:26:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-rename-column-name-with-javascript/m-p/413309#M172747</guid>
      <dc:creator>karn</dc:creator>
      <dc:date>2019-03-02T12:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I rename column name with javascript?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-rename-column-name-with-javascript/m-p/413310#M172748</link>
      <description>&lt;P&gt;Hey There,&lt;/P&gt;

&lt;P&gt;My suggestions are rooted from core Splunk functionality first rather than adding it externally.  &lt;/P&gt;

&lt;P&gt;First thing you can try is  adding some functionality in your search that orders the values accordingly.  Using commands like &lt;CODE&gt;eval&lt;/CODE&gt; may help with adding logic and the flexibility to output your desired field name/ values.  Here is a simple example using &lt;CODE&gt;date_wday&lt;/CODE&gt; that you could use for your Month - Year values (To test, I looked at the Previous Week using the Time Range Picker in my local dev instance):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal
| stats count by date_wday 
| eval week_day = case(date_wday="sunday","0",date_wday="monday", "1", date_wday="tuesday", "2", date_wday="wednesday", "3", date_wday="thursday", "4", date_wday="friday", "5", date_wday="saturday", "6")
| sort week_day
| fields date_wday'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Another option might be to use a lookup file in your search to output field name/ values you want.  The first column header would be the original field name with its list of values, and the second header would be your output field. &lt;/P&gt;

&lt;P&gt;Let me know if this is heading towards the right direction or not we'll go from there.  When in doubt I recommend using Splunk first before JS, etc.  &lt;/P&gt;

&lt;P&gt;Thanks!&lt;BR /&gt;
Greg&lt;/P&gt;</description>
      <pubDate>Sat, 02 Mar 2019 18:43:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-rename-column-name-with-javascript/m-p/413310#M172748</guid>
      <dc:creator>_gkollias</dc:creator>
      <dc:date>2019-03-02T18:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I rename column name with javascript?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-rename-column-name-with-javascript/m-p/413311#M172749</link>
      <description>&lt;P&gt;I found the solution at &lt;A href="https://answers.splunk.com/answers/624857/how-to-avoid-alphabetical-sorting-on-xyseries-comm.html"&gt;https://answers.splunk.com/answers/624857/how-to-avoid-alphabetical-sorting-on-xyseries-comm.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2019 03:53:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-rename-column-name-with-javascript/m-p/413311#M172749</guid>
      <dc:creator>karn</dc:creator>
      <dc:date>2019-03-04T03:53:36Z</dc:date>
    </item>
  </channel>
</rss>

