<?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: How to create a table with time showing in the horizontal direction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-time-showing-in-the-horizontal/m-p/93925#M24176</link>
    <description>&lt;P&gt;Easiest way to switch the direction of the table is to use &lt;CODE&gt;transpose&lt;/CODE&gt;. Just throw "&lt;CODE&gt;| transpose&lt;/CODE&gt;" at the end of your search. However this might not give you exactly the result you want as the time will be output as epoch values, and will not be in the headers.&lt;/P&gt;

&lt;P&gt;Another way is to skip &lt;CODE&gt;timechart&lt;/CODE&gt; and use the regular &lt;CODE&gt;chart&lt;/CODE&gt; command instead, and have it chart over a time field that has been discretized in some way. For instance you can use &lt;CODE&gt;bucket&lt;/CODE&gt; (which is what &lt;CODE&gt;timechart&lt;/CODE&gt; does automatically for you) and create a field that contains the time in a format that is somewhat easier on the eyes than staring at an epoch value. This will give you the same kind of results as using &lt;CODE&gt;timechart&lt;/CODE&gt; with a span of 1 hour.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | bucket span=1h _time | eval formatted_time=strftime(_time, "%c") | chart count over msg by formatted_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or you could use one of the time fields that are likely already in your log events, such as &lt;CODE&gt;date_hour&lt;/CODE&gt;. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | chart count over msg by date_hour
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The only caveat with both of these examples is that if you're going to chart over several days you will need to take that into account, for instance by concatenating the &lt;CODE&gt;date_mday&lt;/CODE&gt; value with &lt;CODE&gt;date_hour&lt;/CODE&gt;, or using another &lt;CODE&gt;strftime&lt;/CODE&gt; format string.&lt;/P&gt;

&lt;P&gt;As for your 2nd question, yes, you can filter the chart to get only times with at least a certain number but it's somewhat more complex when splitting the stats by fields rather than using just one. Have a look at this answer which describes this in more detail: &lt;A href="http://splunk-base.splunk.com/answers/12577/filter-a-chart"&gt;http://splunk-base.splunk.com/answers/12577/filter-a-chart&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2011 20:50:01 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2011-10-18T20:50:01Z</dc:date>
    <item>
      <title>How to create a table with time showing in the horizontal direction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-time-showing-in-the-horizontal/m-p/93924#M24175</link>
      <description>&lt;P&gt;I tried the following:&lt;/P&gt;

&lt;P&gt;host=A earliest=10/01/2011:0:0:0 latest=10/01/2011:11:0:0 | timechart span=1h count by msg&lt;/P&gt;

&lt;P&gt;Where "msg" is a customerized field. It did output the contents I wanted. But I would like the output table to have the time in the horizontal direction, and the  "msg" values (many) in the vertical direction rather than the other way around in the current output. How could I achieve that?&lt;/P&gt;

&lt;P&gt;The 2nd questions: Can I only show those "msg"s whose counts are more than 10 over the entire span (from earliest to latest)?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2011 19:31:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-time-showing-in-the-horizontal/m-p/93924#M24175</guid>
      <dc:creator>myli12</dc:creator>
      <dc:date>2011-10-18T19:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with time showing in the horizontal direction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-time-showing-in-the-horizontal/m-p/93925#M24176</link>
      <description>&lt;P&gt;Easiest way to switch the direction of the table is to use &lt;CODE&gt;transpose&lt;/CODE&gt;. Just throw "&lt;CODE&gt;| transpose&lt;/CODE&gt;" at the end of your search. However this might not give you exactly the result you want as the time will be output as epoch values, and will not be in the headers.&lt;/P&gt;

&lt;P&gt;Another way is to skip &lt;CODE&gt;timechart&lt;/CODE&gt; and use the regular &lt;CODE&gt;chart&lt;/CODE&gt; command instead, and have it chart over a time field that has been discretized in some way. For instance you can use &lt;CODE&gt;bucket&lt;/CODE&gt; (which is what &lt;CODE&gt;timechart&lt;/CODE&gt; does automatically for you) and create a field that contains the time in a format that is somewhat easier on the eyes than staring at an epoch value. This will give you the same kind of results as using &lt;CODE&gt;timechart&lt;/CODE&gt; with a span of 1 hour.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | bucket span=1h _time | eval formatted_time=strftime(_time, "%c") | chart count over msg by formatted_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or you could use one of the time fields that are likely already in your log events, such as &lt;CODE&gt;date_hour&lt;/CODE&gt;. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | chart count over msg by date_hour
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The only caveat with both of these examples is that if you're going to chart over several days you will need to take that into account, for instance by concatenating the &lt;CODE&gt;date_mday&lt;/CODE&gt; value with &lt;CODE&gt;date_hour&lt;/CODE&gt;, or using another &lt;CODE&gt;strftime&lt;/CODE&gt; format string.&lt;/P&gt;

&lt;P&gt;As for your 2nd question, yes, you can filter the chart to get only times with at least a certain number but it's somewhat more complex when splitting the stats by fields rather than using just one. Have a look at this answer which describes this in more detail: &lt;A href="http://splunk-base.splunk.com/answers/12577/filter-a-chart"&gt;http://splunk-base.splunk.com/answers/12577/filter-a-chart&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2011 20:50:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-time-showing-in-the-horizontal/m-p/93925#M24176</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2011-10-18T20:50:01Z</dc:date>
    </item>
  </channel>
</rss>

