<?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 report with counts per column for one specific field? in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/How-to-create-a-report-with-counts-per-column-for-one-specific/m-p/96831#M2229</link>
    <description>&lt;P&gt;Thanks for your response Iguinn, I took snippets of your example above and got something working.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jul 2013 20:23:39 GMT</pubDate>
    <dc:creator>ten_yard_fight</dc:creator>
    <dc:date>2013-07-25T20:23:39Z</dc:date>
    <item>
      <title>How to create a report with counts per column for one specific field?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-create-a-report-with-counts-per-column-for-one-specific/m-p/96829#M2227</link>
      <description>&lt;P&gt;I have a search that breaks down what files were accessed, how much data was retrieved and how many total requests for one particular field. Example search query below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="my_index" source="access_log" directory="/my_app/" | chart count(status_code) AS Requests, sum(file_size) AS TotalData, values(path_to_file) AS FileRequested BY directory
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above query produces something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;directory        Requests      TotalData        FileRequested
my_app           10            345677           html/index.html
                                                images/happy_face.png
                                                dynamic/more_happy.py
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;While this is fine if you only care about the TOTAL number for the entire directory, I would like to break it down so that I can display the number of requests and total data for each of the files requested listed by the directory. The directory should only be displayed once like the example above. Any suggestions? I've tried a couple of different ways but I cant get the directory to only display once and the rest of the rows populated with relevant data per file requested.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 17:18:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-create-a-report-with-counts-per-column-for-one-specific/m-p/96829#M2227</guid>
      <dc:creator>ten_yard_fight</dc:creator>
      <dc:date>2013-07-16T17:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a report with counts per column for one specific field?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-create-a-report-with-counts-per-column-for-one-specific/m-p/96830#M2228</link>
      <description>&lt;P&gt;Splunk is not really designed as a "report writer." Depending on what you want to do, you may find it easier to use Splunk for all the computations and then export the results to a .csv file. Then you can take the csv file into any reporting tool to format it.&lt;/P&gt;

&lt;P&gt;However, this should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="my_index" source="access_log" directory="/my_app/" 
| stats count(status_code) AS Requests, sum(file_size) AS TotalData BY directory path_to_file
| eval sort_key=directory + " " +  path_to_file
| append [ search index="my_index" source="access_log" directory="/my_app/" 
    | stats count(status_code) AS Requests, sum(file_size) AS TotalData BY directory
    | eval sort_key=directory + "***Total" 
    | eval path_to_file = "Total for directory" ]
| sort 0 sort_key
| fields - sort_key
| rename path_to_file as FileRequested
| table directory FileRequested Requests TotalData 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that this will probably take at least twice as much time and resources to run.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 17:38:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-create-a-report-with-counts-per-column-for-one-specific/m-p/96830#M2228</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-07-16T17:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a report with counts per column for one specific field?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-create-a-report-with-counts-per-column-for-one-specific/m-p/96831#M2229</link>
      <description>&lt;P&gt;Thanks for your response Iguinn, I took snippets of your example above and got something working.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2013 20:23:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-create-a-report-with-counts-per-column-for-one-specific/m-p/96831#M2229</guid>
      <dc:creator>ten_yard_fight</dc:creator>
      <dc:date>2013-07-25T20:23:39Z</dc:date>
    </item>
  </channel>
</rss>

