<?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: EC2 instance uptime monthly basis in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/EC2-instance-uptime-monthly-basis/m-p/347846#M164278</link>
    <description>&lt;P&gt;You can run a search like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`aws-description-sourcetype` source="*:ec2_instances"  (aws_account_id="*")   (region="*")  state="running" | timechart count(id) minspan=1h by instance_type
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which will give you a chart of instances running by type (remove the &lt;CODE&gt;by instance_type&lt;/CODE&gt;) to get a total.&lt;/P&gt;

&lt;P&gt;If your interested in the costs of these instances, you can modify one one the dashboard panels to restrict your search to ec2, and use something like this, to show you costs this month vs last:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`aws-cloudwatch-billing( (LinkedAccountId="*") , USD)`|search AmazonEC2 
                            | stats sum(Sum) as sum by _time LinkedAccountId
                            | eval day=strftime(_time, "%Y/%m/%d")
                            | dedup day LinkedAccountId sortby -_time
                            | timechart span=1d sum(sum) as "This Month"
                            | appendcols [ search earliest=-mon@mon latest=-mon `aws-cloudwatch-billing( (LinkedAccountId="*") , USD)`
                            | stats sum(Sum) as sum by _time LinkedAccountId
                            | eval day=strftime(_time, "%Y/%m/%d")
                            | dedup day LinkedAccountId sortby -_time
                            | timechart span=1d sum(sum) as "Last Month"]
                            | fields _time "Last Month" "This Month"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Take a look at the dashboard panels available in the app, as these provide a great starting point for any queries you want to refine.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Dec 2017 08:31:42 GMT</pubDate>
    <dc:creator>nickhills</dc:creator>
    <dc:date>2017-12-19T08:31:42Z</dc:date>
    <item>
      <title>EC2 instance uptime monthly basis</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EC2-instance-uptime-monthly-basis/m-p/347842#M164274</link>
      <description>&lt;P&gt;The EC2 instances in my AWS environment are daily shutdown and startup on next day as per requirement. I want to develop a report which will display how much hours an EC2 instance was up and down in a month. Please suggest if it is possible through Splunk or not?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 10:27:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EC2-instance-uptime-monthly-basis/m-p/347842#M164274</guid>
      <dc:creator>samindradey</dc:creator>
      <dc:date>2017-12-18T10:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: EC2 instance uptime monthly basis</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EC2-instance-uptime-monthly-basis/m-p/347843#M164275</link>
      <description>&lt;P&gt;I would start by installing the Splunk App for AWS (and the TA, as per the instructions)&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/AWS/5.1.0/Installation/Installon-prem"&gt;http://docs.splunk.com/Documentation/AWS/5.1.0/Installation/Installon-prem&lt;/A&gt;&lt;BR /&gt;
This app, among other things, will collect events and actions taken on all your AWS resources and will allow you to search and filter them by tag/name/instance/id/Az/region etc.&lt;BR /&gt;
You will also get access to the very comprehensive billing prediction and breakdown tools - not to mention user auditing, and performance metrics.&lt;/P&gt;

&lt;P&gt;To directly answer your question, you will be able to see exactly how many hours each machine has been running.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 15:49:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EC2-instance-uptime-monthly-basis/m-p/347843#M164275</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2017-12-18T15:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: EC2 instance uptime monthly basis</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EC2-instance-uptime-monthly-basis/m-p/347844#M164276</link>
      <description>&lt;P&gt;Thanks! I am able to search the instances but in a month how many hours the instance was up and down is not able to create as a report. Can you please help?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 06:22:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EC2-instance-uptime-monthly-basis/m-p/347844#M164276</guid>
      <dc:creator>samindradey</dc:creator>
      <dc:date>2017-12-19T06:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: EC2 instance uptime monthly basis</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EC2-instance-uptime-monthly-basis/m-p/347845#M164277</link>
      <description>&lt;P&gt;Thanks! I am able to search the instances but not able to create a report which will show how long the instance was up and down in a month. Can you please help?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 06:24:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EC2-instance-uptime-monthly-basis/m-p/347845#M164277</guid>
      <dc:creator>samindradey</dc:creator>
      <dc:date>2017-12-19T06:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: EC2 instance uptime monthly basis</title>
      <link>https://community.splunk.com/t5/Splunk-Search/EC2-instance-uptime-monthly-basis/m-p/347846#M164278</link>
      <description>&lt;P&gt;You can run a search like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`aws-description-sourcetype` source="*:ec2_instances"  (aws_account_id="*")   (region="*")  state="running" | timechart count(id) minspan=1h by instance_type
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which will give you a chart of instances running by type (remove the &lt;CODE&gt;by instance_type&lt;/CODE&gt;) to get a total.&lt;/P&gt;

&lt;P&gt;If your interested in the costs of these instances, you can modify one one the dashboard panels to restrict your search to ec2, and use something like this, to show you costs this month vs last:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`aws-cloudwatch-billing( (LinkedAccountId="*") , USD)`|search AmazonEC2 
                            | stats sum(Sum) as sum by _time LinkedAccountId
                            | eval day=strftime(_time, "%Y/%m/%d")
                            | dedup day LinkedAccountId sortby -_time
                            | timechart span=1d sum(sum) as "This Month"
                            | appendcols [ search earliest=-mon@mon latest=-mon `aws-cloudwatch-billing( (LinkedAccountId="*") , USD)`
                            | stats sum(Sum) as sum by _time LinkedAccountId
                            | eval day=strftime(_time, "%Y/%m/%d")
                            | dedup day LinkedAccountId sortby -_time
                            | timechart span=1d sum(sum) as "Last Month"]
                            | fields _time "Last Month" "This Month"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Take a look at the dashboard panels available in the app, as these provide a great starting point for any queries you want to refine.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 08:31:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/EC2-instance-uptime-monthly-basis/m-p/347846#M164278</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2017-12-19T08:31:42Z</dc:date>
    </item>
  </channel>
</rss>

