<?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: time format for results in en-US vs en-GB in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/time-format-for-results-in-en-US-vs-en-GB/m-p/26520#M4375</link>
    <description>&lt;P&gt;I found this solution useful:&lt;/P&gt;

&lt;P&gt;My browser will use german locale de-DE per default, which is not supported by splunk. Changing this to en-GB is not an option&lt;/P&gt;

&lt;P&gt;Under&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;/opt/splunk/lib/python2.6/site-packages/splunk/appserver/mrsparkle/locale&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I found a set of directories for supported locales, renamed (or better copied) en_GB to de_DE and restarted splunk&lt;/P&gt;

&lt;P&gt;Note:&lt;BR /&gt;
in the URL, the locale is called de-DE, while the above mentioned directory is called de_DE. Not sure why, but it works.&lt;/P&gt;</description>
    <pubDate>Fri, 14 Oct 2011 15:11:58 GMT</pubDate>
    <dc:creator>waechtler</dc:creator>
    <dc:date>2011-10-14T15:11:58Z</dc:date>
    <item>
      <title>time format for results in en-US vs en-GB</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-format-for-results-in-en-US-vs-en-GB/m-p/26517#M4372</link>
      <description>&lt;P&gt;I recently received a case about the following issue and since it has come up before on my cases i think it would be a good idea writing a little answers question about it.&lt;/P&gt;

&lt;P&gt;So, there are two main differences in results when viewing the same page in GB vs US. (ie, localhost:port/en-US vs localhost:port/en-GB/)&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;in GB, the event timestamp shows up in 24hrs format, instead in the US version, it shows up as 12hour format.&lt;/LI&gt;
&lt;LI&gt;In GB the time is right behind the date, instead on the US it is separated by a linebreak.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;By default en-US and en-GB get set by the browser locale (which in turn i believe gets set by the OS).
If i wanted my results to always default to GB, it would be easy to change the locale on my browser, however, if i wanted to do this change company wide this would be a nightmare.&lt;/P&gt;

&lt;P&gt;Is there a way, to tell splunk to default the time format to en-GB locale but server side (instead of client side)?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2011 07:03:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-format-for-results-in-en-US-vs-en-GB/m-p/26517#M4372</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2011-01-14T07:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: time format for results in en-US vs en-GB</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-format-for-results-in-en-US-vs-en-GB/m-p/26518#M4373</link>
      <description>&lt;P&gt;This took a little bit of digging and poking the UI dev's but can be achieved quite nicely.&lt;/P&gt;

&lt;P&gt;There's a file in &lt;CODE&gt;/splunkhome/share/splunk/search_mrsparkle/modules/results&lt;/CODE&gt; where the results are formated.
around line 72 we have:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;% if i18n.current_lang_url_component()=="en-US":
    ${i18n.format_datetime_microseconds(event.time).replace(' ', '&amp;lt;br/&amp;gt;', 1).replace(' ', '&amp;amp;nbsp;')}
% else:
    ${i18n.format_datetime_microseconds(event.time)}
% endif
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is the file that i will be working with.
First thing to note however, is that i will be making changes to the code, and as such i do not want to make these changes on the default file for two reasons:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;If i break things then splunk will not support any further issues i might have in the future  &lt;/LI&gt;
&lt;LI&gt;any future upgrade will overwrite my changes and make my efforts go to waste.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Hence, i will create a new app, where i will put all my file changes, and since apps have higher precedence my changed file will be read over the default one.&lt;/P&gt;

&lt;P&gt;Start start by creating a new application within your splunk instance:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
  &lt;P&gt;pwd  &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;PRE&gt;&lt;CODE&gt;/splunkhome/etc/apps
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Make new app directory by:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;gt; mkdir time  
&amp;gt; mkdir time/appserver  
&amp;gt; mkdir time/appserver/modules/ 
&amp;gt; mkdir time/appserver/modules/results 
&amp;gt; cd time/appserver/modules/results 


&amp;gt; pwd

/splunkhome/etc/apps/time/appserver/modules/results
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Copy the file from the default location into this app/directory:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
  &lt;P&gt;cp /splunkhome/share/splunk/search_mrsparkle/modules/results/EventsViewer_default_renderer.html .&lt;/P&gt;
  
  &lt;P&gt;ls&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;PRE&gt;&lt;CODE&gt;EventsViewer_default_renderer.html
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Modify this file such that the if-condition on line 72 looks like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;% if i18n.current_lang_url_component()=="en-US":
    ${(event.time.strftime('%d/%m/%Y %H:%M:%S'))}
% else:
    ${i18n.format_datetime_microseconds(event.time)}
% endif
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Refresh your web page, and your /en-US/ will look as if it was /en-GB/ through out all your browsers all around the company.&lt;/P&gt;

&lt;P&gt;One thing to note:&lt;BR /&gt;
adding %f right after %S will add microseconds. 6 significant digits of them. I was unable to only show just 3 significant digits, like the default splunk view is. i tried %3f %.3f etc, but none of them seems to be working. If anyone finds the solution to this it would be cool.&lt;/P&gt;

&lt;P&gt;Hope this helps people out there.&lt;BR /&gt;
Cheers,&lt;BR /&gt;
.gz&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2011 07:25:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-format-for-results-in-en-US-vs-en-GB/m-p/26518#M4373</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2011-01-14T07:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: time format for results in en-US vs en-GB</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-format-for-results-in-en-US-vs-en-GB/m-p/26519#M4374</link>
      <description>&lt;P&gt;The question regarding the %f is what event.time is.  Try type(event.time) to see what it claims to be.   Or ask a ui developer.&lt;/P&gt;

&lt;P&gt;Personally I'd do some awful hack such as..., assuming event.time can be the integer,&lt;/P&gt;

&lt;P&gt;milliseconds = ("%s.5" % str(event.time % 1))[2:]&lt;/P&gt;

&lt;P&gt;${(event.time.strftime('%d/%m/%Y %H:%M:%S') + milliseconds )}&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2011 07:53:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-format-for-results-in-en-US-vs-en-GB/m-p/26519#M4374</guid>
      <dc:creator>jrodman</dc:creator>
      <dc:date>2011-01-14T07:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: time format for results in en-US vs en-GB</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-format-for-results-in-en-US-vs-en-GB/m-p/26520#M4375</link>
      <description>&lt;P&gt;I found this solution useful:&lt;/P&gt;

&lt;P&gt;My browser will use german locale de-DE per default, which is not supported by splunk. Changing this to en-GB is not an option&lt;/P&gt;

&lt;P&gt;Under&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;/opt/splunk/lib/python2.6/site-packages/splunk/appserver/mrsparkle/locale&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I found a set of directories for supported locales, renamed (or better copied) en_GB to de_DE and restarted splunk&lt;/P&gt;

&lt;P&gt;Note:&lt;BR /&gt;
in the URL, the locale is called de-DE, while the above mentioned directory is called de_DE. Not sure why, but it works.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2011 15:11:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-format-for-results-in-en-US-vs-en-GB/m-p/26520#M4375</guid>
      <dc:creator>waechtler</dc:creator>
      <dc:date>2011-10-14T15:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: time format for results in en-US vs en-GB</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-format-for-results-in-en-US-vs-en-GB/m-p/26521#M4376</link>
      <description>&lt;P&gt;For time in US format, but with 24h clock.&lt;BR /&gt;
Try :&lt;BR /&gt;
strftime('%m/%d/%Y %H:%M:%S')&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2011 01:47:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-format-for-results-in-en-US-vs-en-GB/m-p/26521#M4376</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2011-11-08T01:47:42Z</dc:date>
    </item>
  </channel>
</rss>

