<?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 date not displaying in table correctly in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423040#M41300</link>
    <description>&lt;P&gt;@mrclayton, Seems like you are using Post Processing. While using Post-processing in your dashboard you should ensure that you aggregate the results using transforming commands to restrict the total number of search results being passed on from one search to another. Ideally they should not end with &lt;CODE&gt;table&lt;/CODE&gt;, rather &lt;CODE&gt;stats&lt;/CODE&gt; or other aggregating transforming command.&lt;/P&gt;

&lt;P&gt;In case you you want to pass on all the fields from raw events, you can use &lt;CODE&gt;| fields *&lt;/CODE&gt; as your final pipe in your search. However, they still may have performance issues and may not pass on all the results. You should refer to documentation for post-processing best practices to ensure that it handles generating stats in your base search and then re-use them in other panels. In case you can not do so, you would be better off running independent searches instead of post-processing. Refer to &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Viz/Savedsearches#Best_practices"&gt;Post Processing Best Practices&lt;/A&gt; Documentation.&lt;/P&gt;

&lt;P&gt;Refer to one of my older answers: &lt;A href="https://answers.splunk.com/answers/607583/why-doesnt-my-xml-base-search-work.html"&gt;https://answers.splunk.com/answers/607583/why-doesnt-my-xml-base-search-work.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Jul 2018 16:20:19 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2018-07-09T16:20:19Z</dc:date>
    <item>
      <title>Splunk date not displaying in table correctly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423033#M41293</link>
      <description>&lt;P&gt;Have an event that includes an object's due date in the format &lt;STRONG&gt;Fri Jul 06 00:00:00 PDT 2018&lt;/STRONG&gt;. When I view the event via a search the due date is displayed correctly. However, when creating a table report via a dashboard, the date only displays as &lt;STRONG&gt;Fri&lt;/STRONG&gt; so it appears it's being stripped by Splunk during the table render. I tried to use the function strptime on the date using format %a %b %d %T %Z %Y but further tests using eval revealed that the due date value is sent to the function as &lt;STRONG&gt;Fri&lt;/STRONG&gt; before I can even manipulate it.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5319iC569A3B660B3176B/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5320iCBEDD5B02170838F/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Kind Regards,&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jul 2018 17:10:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423033#M41293</guid>
      <dc:creator>mrclayton</dc:creator>
      <dc:date>2018-07-06T17:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date not displaying in table correctly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423034#M41294</link>
      <description>&lt;P&gt;Hi @mrclayton, is it possible to share the search (you shall sanitize confidential data if any) ? It looks like one of your eval is stripping the week day. Try adding the strptime just after the base search&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jul 2018 02:36:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423034#M41294</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-07-07T02:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date not displaying in table correctly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423035#M41295</link>
      <description>&lt;P&gt;To renjith.nair's point, please share your search.  It's always helpful to share any data samples or searches.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jul 2018 15:02:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423035#M41295</guid>
      <dc:creator>kmorris_splunk</dc:creator>
      <dc:date>2018-07-07T15:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date not displaying in table correctly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423036#M41296</link>
      <description>&lt;P&gt;@mrclayton, if you are seeing the date field &lt;CODE&gt;dueDate&lt;/CODE&gt; with values like &lt;CODE&gt;Fri Jul 06 00:00:00 PDT 2018&lt;/CODE&gt; in your raw events, you can directly use them in your table without using &lt;CODE&gt;strftime()&lt;/CODE&gt; as that will be in String Date format already by default. If in your search you need to convert it to epoch &lt;CODE&gt;strptime()&lt;/CODE&gt;, then for displaying epoch time as string time in table you can use &lt;CODE&gt;fieldformat&lt;/CODE&gt; in the end. Following is run anywhere search based on sample field/data provided as per the question.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval dueDate="Fri Jul 06 00:00:00 PDT 2018"
| eval "Due Date"=strptime(dueDate,"%a %b %d %T %Z %Y")
| fieldformat "Due Date"=strftime('Due Date',"%a %b %d %T %Z %Y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If your issue is something else, please add more details from your current search as to what modifications are being done on the Due Date field.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jul 2018 17:42:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423036#M41296</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-07-07T17:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date not displaying in table correctly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423037#M41297</link>
      <description>&lt;P&gt;This should be trivial to fix if you show us your exact search.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Jul 2018 20:19:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423037#M41297</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-08T20:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date not displaying in table correctly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423038#M41298</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;Thank you for the replies. I have included the base event search which renders the dueDate correctly, along with the dashboard search which renders the dueDate incorrectly.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5318i62A34C60DED68E08/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="my_index" sourcetype="my:logging:system" name="payBill" host="$host$" userId="$userId$" | eval date=strftime(timestamp/1000, "%c")|table name host userId clientId date legacyAccount partialAmount invoiceId vbeln xblnr dueDate invoiceDate| rename name as "Event", host as "Server", userId as "User ID", clientId as "Client ID", date as "Date", vbeln as "Billing Document", xblnr as "Reference Document", legacyAccount as "Legacy Account", dueDate as "Due Date", invoiceDate as "Invoice Date", invoiceId as "Invoice ID", dueDate as "Due Date", partialAmount as "Payment Amount"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jul 2018 15:53:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423038#M41298</guid>
      <dc:creator>mrclayton</dc:creator>
      <dc:date>2018-07-09T15:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date not displaying in table correctly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423039#M41299</link>
      <description>&lt;P&gt;Base Search (works):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="my_index" sourcetype="my:logging:system" name="payBill" host="$host$" userId="$userId$" | eval date=strftime(timestamp/1000, "%c")|table name host userId clientId date legacyAccount partialAmount invoiceId vbeln xblnr dueDate invoiceDate| rename name as "Event", host as "Server", userId as "User ID", clientId as "Client ID", date as "Date", vbeln as "Billing Document", xblnr as "Reference Document", legacyAccount as "Legacy Account", dueDate as "Due Date", invoiceDate as "Invoice Date", invoiceId as "Invoice ID", dueDate as "Due Date", partialAmount as "Payment Amount"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Dashboard Search (doesn't work):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="my_index" sourcetype="my:logging:system" name="payBill" host="$host$" userId="$userId$" | eval date=strftime(timestamp/1000, "%c")|table name host userId clientId date legacyAccount partialAmount invoiceId vbeln xblnr dueDate invoiceDate| rename name as "Event", host as "Server", userId as "User ID", clientId as "Client ID", date as "Date", vbeln as "Billing Document", xblnr as "Reference Document", legacyAccount as "Legacy Account", dueDate as "Due Date", invoiceDate as "Invoice Date", invoiceId as "Invoice ID", dueDate as "Due Date", partialAmount as "Payment Amount"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jul 2018 16:04:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423039#M41299</guid>
      <dc:creator>mrclayton</dc:creator>
      <dc:date>2018-07-09T16:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date not displaying in table correctly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423040#M41300</link>
      <description>&lt;P&gt;@mrclayton, Seems like you are using Post Processing. While using Post-processing in your dashboard you should ensure that you aggregate the results using transforming commands to restrict the total number of search results being passed on from one search to another. Ideally they should not end with &lt;CODE&gt;table&lt;/CODE&gt;, rather &lt;CODE&gt;stats&lt;/CODE&gt; or other aggregating transforming command.&lt;/P&gt;

&lt;P&gt;In case you you want to pass on all the fields from raw events, you can use &lt;CODE&gt;| fields *&lt;/CODE&gt; as your final pipe in your search. However, they still may have performance issues and may not pass on all the results. You should refer to documentation for post-processing best practices to ensure that it handles generating stats in your base search and then re-use them in other panels. In case you can not do so, you would be better off running independent searches instead of post-processing. Refer to &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Viz/Savedsearches#Best_practices"&gt;Post Processing Best Practices&lt;/A&gt; Documentation.&lt;/P&gt;

&lt;P&gt;Refer to one of my older answers: &lt;A href="https://answers.splunk.com/answers/607583/why-doesnt-my-xml-base-search-work.html"&gt;https://answers.splunk.com/answers/607583/why-doesnt-my-xml-base-search-work.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 16:20:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423040#M41300</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-07-09T16:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date not displaying in table correctly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423041#M41301</link>
      <description>&lt;P&gt;Hi @niketnilay thanks for the reply. Unfortunately this does not seem to explain why the dueDate field is being displayed as &lt;STRONG&gt;Fri&lt;/STRONG&gt;. &lt;/P&gt;

&lt;P&gt;For example, if I perform the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="test" sourcetype="my:sourcetype" name="payBill" host="example.com" userId="*" dueDate="Fri Jul 06 00:00:00 PDT 2018"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't get back any results. But if I perform:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="test" sourcetype="my:sourcetype" name="payBill" host="example.com" userId="*" dueDate="Fri"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get the expected result. So, it appears the dueDate field is being stripped even before I have access to it.&lt;/P&gt;

&lt;P&gt;Kind Regards,&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 19:32:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423041#M41301</guid>
      <dc:creator>mrclayton</dc:creator>
      <dc:date>2018-07-09T19:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date not displaying in table correctly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423042#M41302</link>
      <description>&lt;P&gt;@mrclayton I am sorry I had confused your question with someone else's after reading the last comment.  You would need to create your own field extraction on raw data to extract dueDate correctly.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 01:14:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423042#M41302</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-07-10T01:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date not displaying in table correctly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423043#M41303</link>
      <description>&lt;P&gt;@mrclayton, the reason why Search Time Field Discovery is not working by default is that the Key Value pair are both present within same Quotes. So space after Week abbreviation i.e. &lt;CODE&gt;Fri&lt;/CODE&gt;, &lt;CODE&gt;Sat&lt;/CODE&gt; etc will be treated as breakers for default Field Extraction. Following run anywhere example &lt;CODE&gt;Mimics the issue behavior&lt;/CODE&gt; as to what is happening with your _raw data during Search Time Field Discovery:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="\"dueDate=Fri Jul 06 00:00:00 PDT 2018\" \"invoiceDate=Wed Jul 04 00:00:00 PDT 2018\""
| KV
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ideal way would be to correct the data to have &lt;CODE&gt;key="value"&lt;/CODE&gt; format so that default Search Time Field Discovery works for all the fields by default. Following run anywhere example shows behavior with data fixed:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="dueDate=\"Fri Jul 06 00:00:00 PDT 2018\" invoiceDate=\"Wed Jul 04 00:00:00 PDT 2018\"" 
| KV
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Other option would be create your own field extraction using correct regular expression. Add the following rex command after your base search &lt;CODE&gt;| rex "\"dueDate=(?&amp;lt;dueDate&amp;gt;[^\"]+)\"\s"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Following is a run anywhere example with rex command (regular expression based field extraction):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="\"dueDate=Fri Jul 06 00:00:00 PDT 2018\" \"invoiceDate="
| rex "\"dueDate=(?&amp;lt;dueDate&amp;gt;[^\"]+)\"\s"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Once you have tested the extraction to work with your sample data, you should move the same to Fields Knowledge Object using &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ExtractfieldsinteractivelywithIFX"&gt;Interactive Field Extraction&lt;/A&gt; or props.conf directly using regular expression above.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 01:33:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423043#M41303</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-07-10T01:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date not displaying in table correctly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423044#M41304</link>
      <description>&lt;P&gt;@niketnilay, thank you for such a thorough response. I will try your suggestions and provide an update along with an accepted answer if applicable.&lt;/P&gt;

&lt;P&gt;What's interesting about the key and value being in the same quotes is that's how the JAVA library outputs the values. The following code sample is taken directly from the Java class that outputs the event data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;private static final Pattern DOUBLE_QUOTE = Pattern.compile("\"");
    @Override
    public String toString() {
        StringBuilder output = new StringBuilder();

        boolean first = true;
        for (String key : entries.keySet()) {
            if (!first) {
                output.append(PAIRDELIM);
            } else {
                first = false;
            }
            String value = entries.get(key).toString();

            // Escape any " that appear in the key or value.
            key = DOUBLE_QUOTE.matcher(key).replaceAll("\\\\\"");
            value = DOUBLE_QUOTE.matcher(value).replaceAll("\\\\\"");

            output.append(QUOTE).append(key).append(KVDELIM).append(value).append(QUOTE);
        }

        return output.toString();
    }
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Jul 2018 17:30:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-date-not-displaying-in-table-correctly/m-p/423044#M41304</guid>
      <dc:creator>mrclayton</dc:creator>
      <dc:date>2018-07-10T17:30:46Z</dc:date>
    </item>
  </channel>
</rss>

