<?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: Add field post stats and transpose commands in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Add-field-post-stats-and-transpose-commands/m-p/553992#M157266</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228215"&gt;@ebs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note the syntax I used in my original regarding use of tokens&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval date=$date|s$&lt;/LI-CODE&gt;&lt;P&gt;The |s (pipe s) before the closing $ sign is an instruction to the token handler as to how to represent the token.&lt;/P&gt;&lt;P&gt;See this link&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.0/Viz/tokens#Syntax_to_consume_tokens" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.0/Viz/tokens#Syntax_to_consume_tokens&lt;/A&gt;&lt;/P&gt;&lt;P&gt;which shows what | token commands are available and how they affect token usage.&lt;/P&gt;&lt;P&gt;Using this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval date="$date$"&lt;/LI-CODE&gt;&lt;P&gt;is the same when using the token in a dashboard, but there are subtle differences in how the |s syntax works compared to simple quoting when using the token in Javascript.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Jun 2021 00:20:53 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2021-06-02T00:20:53Z</dc:date>
    <item>
      <title>Add field post stats and transpose commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-field-post-stats-and-transpose-commands/m-p/553743#M157224</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want my data presented in a very specific way, which means I can't go the typical route of just adding the field I want presented after the by in my stats command as I'm using transpose on the header fields.&lt;/P&gt;&lt;P&gt;I can't use eventstats because that completely messes up my stats table.&lt;/P&gt;&lt;P&gt;This is the search:&lt;/P&gt;&lt;P&gt;| datamodel Test summariesonly=true search&lt;BR /&gt;| search "TEST.date"=2021-05-18| rename "TEST.date" as date&lt;BR /&gt;| rename "TEST.uri_path" as uri_path&lt;BR /&gt;| eval category=case(like(uri_path, "/url1), "highPriority", uri_path="/url2", "unattended",&lt;BR /&gt;uri_path="/url3, "lowPriority", uri_path="/url4", "largePayload")&lt;BR /&gt;| rename "TEST.response_time" as response_time&lt;BR /&gt;| stats avg(response_time) by category&lt;BR /&gt;| rename avg(response_time) as averageResponse&lt;BR /&gt;| eval averageResponse=round(averageResponse,3)&lt;BR /&gt;| transpose 0 header_field=category&lt;BR /&gt;| fillnull value=0 highPriority, lowPriority, largePayload, unattended&lt;BR /&gt;| fields highPriority, lowPriority, largePayload, unattended, date&lt;/P&gt;&lt;P&gt;I want to be able to fill my date field with the previously defined date field&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jun 2021 00:15:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-field-post-stats-and-transpose-commands/m-p/553743#M157224</guid>
      <dc:creator>ebs</dc:creator>
      <dc:date>2021-06-01T00:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: Add field post stats and transpose commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-field-post-stats-and-transpose-commands/m-p/553747#M157227</link>
      <description>&lt;P&gt;So, where does your hard-coded string "2021-05-18" come from - if it really is just hard coded, you could just do&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fillnull value=0 highPriority, lowPriority, largePayload, unattended 
| eval date="2021-05-18"
| fields highPriority, lowPriority, largePayload, unattended, date&lt;/LI-CODE&gt;&lt;P&gt;but I suspect it's not, so if your condition is coming from a token, e.g. $date$, then you could still do the same, with&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval date=$date|s$&lt;/LI-CODE&gt;&lt;P&gt;or you could do this after the round&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval averageResponse=round(averageResponse,3)
| append [
  | makeresults 
  | fields - _time
  | eval category="date", averageResponse="2021-05-18"
]&lt;/LI-CODE&gt;&lt;P&gt;again, depending on where your condition is coming from, the same issue applies.&lt;/P&gt;&lt;P&gt;Note a couple of tips for your existing SPL.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can do this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rename "TEST.*" as *&lt;/LI-CODE&gt;&lt;P&gt;and&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats avg(response_time) as averageResponse by category&lt;/LI-CODE&gt;&lt;P&gt;so you don't have to do the other separate renames&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jun 2021 00:36:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-field-post-stats-and-transpose-commands/m-p/553747#M157227</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-06-01T00:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Add field post stats and transpose commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-field-post-stats-and-transpose-commands/m-p/553985#M157263</link>
      <description>&lt;P&gt;It is a token, so thank you but something weird happens when I have the command &lt;EM&gt;| eval date-$date&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;It comes up in my table as 1998 and I have no idea why because the correlating values from my first enterance of that date is accurate.&lt;/P&gt;&lt;P&gt;Please advise&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jun 2021 22:46:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-field-post-stats-and-transpose-commands/m-p/553985#M157263</guid>
      <dc:creator>ebs</dc:creator>
      <dc:date>2021-06-01T22:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Add field post stats and transpose commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-field-post-stats-and-transpose-commands/m-p/553987#M157264</link>
      <description>&lt;P&gt;Figured it out, I needed quotations around the token or it would have taken it as a mathematical expression&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jun 2021 23:03:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-field-post-stats-and-transpose-commands/m-p/553987#M157264</guid>
      <dc:creator>ebs</dc:creator>
      <dc:date>2021-06-01T23:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Add field post stats and transpose commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-field-post-stats-and-transpose-commands/m-p/553992#M157266</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228215"&gt;@ebs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note the syntax I used in my original regarding use of tokens&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval date=$date|s$&lt;/LI-CODE&gt;&lt;P&gt;The |s (pipe s) before the closing $ sign is an instruction to the token handler as to how to represent the token.&lt;/P&gt;&lt;P&gt;See this link&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.0/Viz/tokens#Syntax_to_consume_tokens" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.0/Viz/tokens#Syntax_to_consume_tokens&lt;/A&gt;&lt;/P&gt;&lt;P&gt;which shows what | token commands are available and how they affect token usage.&lt;/P&gt;&lt;P&gt;Using this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval date="$date$"&lt;/LI-CODE&gt;&lt;P&gt;is the same when using the token in a dashboard, but there are subtle differences in how the |s syntax works compared to simple quoting when using the token in Javascript.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 00:20:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-field-post-stats-and-transpose-commands/m-p/553992#M157266</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-06-02T00:20:53Z</dc:date>
    </item>
  </channel>
</rss>

