<?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 count the number of license pool violations using REST... in Security</title>
    <link>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290694#M13497</link>
    <description>&lt;P&gt;Hey kids, don't be shy with the 'pow' function of eval.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;round(quota/1024/1024/1024,3)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;could be:&lt;BR /&gt;
&lt;CODE&gt;round( quota / pow( 1024 , 3 ) , 3 )&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Whichever is easier to read.&lt;/P&gt;

&lt;P&gt;Anyway, this is amazing! Great work!&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2017 12:42:27 GMT</pubDate>
    <dc:creator>sloshburch</dc:creator>
    <dc:date>2017-03-28T12:42:27Z</dc:date>
    <item>
      <title>How to count the number of license pool violations using REST...</title>
      <link>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290683#M13486</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have the search below, which provides license pool violations information.  I want to take this information and generate a report that shows only the violations for the past 7 days.  Unfortunately, the "Warning Days - (Soft)/Hard" field contains the dates, and it puts them all into one event.  Is there anyway to break these out?&lt;/P&gt;

&lt;P&gt;Search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest splunk_server=local /services/licenser/messages 
| where (category=="license_window" OR category=="pool_over_quota") AND create_time &amp;gt;= now() - (30 * 86400) 
| rename pool_id AS pool 
| eval warning_day=if(category=="pool_over_quota","(".strftime(create_time,"%B %e, %Y").")",strftime(create_time-43200,"%B %e, %Y")) 
| fields pool warning_day 
| join outer pool 
    [ rest splunk_server=local /services/licenser/slaves 
    | mvexpand active_pool_ids 
    | eval slave_name=label 
    | eval pool=active_pool_ids 
    | fields pool slave_name 
    | stats values(slave_name) as "members" by pool] 
| join outer pool 
    [ rest splunk_server=local /services/licenser/pools 
    | eval pool=title 
    | eval quota=if(isnull(effective_quota),quota,effective_quota) 
    | eval quotaGB=round(quota/1024/1024/1024,3) 
    | fields pool stack_id, quotaGB] 
| stats first(pool) as "Pool" first(stack_id) as "Stack ID" first(members) as "Current Members" first(quotaGB) as "Current Quota (GB)" values(warning_day) AS "Warning Days - (Soft)/Hard" by pool 
| fields - pool 
| where Pool = "FMD License" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here's the output:&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/2677iB0AF7E0B943AE4D7/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 02:02:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290683#M13486</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2017-03-22T02:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of license pool violations using REST...</title>
      <link>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290684#M13487</link>
      <description>&lt;P&gt;Might not be the best way but first thing that comes to mind is &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.2/SearchReference/Mvexpand"&gt;mvexpand&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.2/SearchReference/Mvexpand"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.2/SearchReference/Mvexpand&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 11:52:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290684#M13487</guid>
      <dc:creator>mtranchita</dc:creator>
      <dc:date>2017-03-22T11:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of license pool violations using REST...</title>
      <link>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290685#M13488</link>
      <description>&lt;P&gt;I think stats command will count the values of a multivalue field. Start with that?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 12:09:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290685#M13488</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2017-03-22T12:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of license pool violations using REST...</title>
      <link>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290686#M13489</link>
      <description>&lt;P&gt;@a212830 can you add &lt;CODE&gt;count(warning_day) as Count&lt;/CODE&gt; to the final stats query in your example?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 12:21:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290686#M13489</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-03-22T12:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of license pool violations using REST...</title>
      <link>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290687#M13490</link>
      <description>&lt;P&gt;Add this to your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| mvexpand "Warning Days - (Soft)/Hard"
| eval _time = coalesce(strptime('Warning Days - (Soft)/Hard', "(%B %d %, %Y)"), strptime('Warning Days - (Soft)/Hard', "%B %d %, %Y"))
| eval daysAgo = (now() - _time) / (24 *60 * 60)
| search daysAgo &amp;lt;= 7
| stats values("Warning Days - (Soft)/Hard") AS "Warning Days - (Soft)/Hard" BY Pool
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Mar 2017 23:17:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290687#M13490</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-23T23:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of license pool violations using REST...</title>
      <link>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290688#M13491</link>
      <description>&lt;P&gt;The Warning days are being calculated in the first query from the field create_time. You can just filter the events there to show only the warning that have occurred in last 7 days, like this (line 3 added)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest splunk_server=local /services/licenser/messages 
 | where (category=="license_window" OR category=="pool_over_quota") AND create_time &amp;gt;= now() - (30 * 86400) 
 | rename pool_id AS pool 
 | where create_time&amp;gt;=relative_time(now(),"-7d@d")
 | eval warning_day=if(category=="pool_over_quota","(".strftime(create_time,"%B %e, %Y").")",strftime(create_time-43200,"%B %e, %Y")) 
 | fields pool warning_day 
 | join outer pool 
     [ rest splunk_server=local /services/licenser/slaves 
     | mvexpand active_pool_ids 
     | eval slave_name=label 
     | eval pool=active_pool_ids 
     | fields pool slave_name 
     | stats values(slave_name) as "members" by pool] 
 | join outer pool 
     [ rest splunk_server=local /services/licenser/pools 
     | eval pool=title 
     | eval quota=if(isnull(effective_quota),quota,effective_quota) 
     | eval quotaGB=round(quota/1024/1024/1024,3) 
     | fields pool stack_id, quotaGB] 
 | stats first(pool) as "Pool" first(stack_id) as "Stack ID" first(members) as "Current Members" first(quotaGB) as "Current Quota (GB)" values(warning_day) AS "Warning Days - (Soft)/Hard" by pool 
 | fields - pool 
 | where Pool = "FMD License" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Mar 2017 02:02:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290688#M13491</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-24T02:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of license pool violations using REST...</title>
      <link>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290689#M13492</link>
      <description>&lt;P&gt;Thanks.  Didn't like the eval:  " Error in 'eval' command: The arguments to the 'strptime' function are invalid."&lt;/P&gt;</description>
      <pubDate>Sun, 26 Mar 2017 14:12:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290689#M13492</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2017-03-26T14:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of license pool violations using REST...</title>
      <link>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290690#M13493</link>
      <description>&lt;P&gt;Figured out the strptime issue,  so it now looks like this and appears to work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest splunk_server=local /services/licenser/messages 
| where (category=="license_window" OR category=="pool_over_quota") AND create_time &amp;gt;= now() - (30 * 86400) 
| rename pool_id AS pool 
| eval warning_day=if(category=="pool_over_quota","(".strftime(create_time,"%B %e, %Y").")",strftime(create_time-43200,"%B %e, %Y")) 
| fields pool warning_day 
| join outer pool 
    [ rest splunk_server=local /services/licenser/slaves 
    | mvexpand active_pool_ids 
    | eval slave_name=label 
    | eval pool=active_pool_ids 
    | fields pool slave_name 
    | stats values(slave_name) as "members" by pool] 
| join outer pool 
    [ rest splunk_server=local /services/licenser/pools 
    | eval pool=title 
    | eval quota=if(isnull(effective_quota),quota,effective_quota) 
    | eval quotaGB=round(quota/1024/1024/1024,3) 
    | fields pool stack_id, quotaGB] 
| stats first(pool) as "Pool" first(stack_id) as "Stack ID" first(members) as "Current Members" first(quotaGB) as "Current Quota (GB)" values(warning_day) AS "Warning Days - (Soft)/Hard" by pool 
| fields - pool 
| where Pool = "FMD License" 
| mvexpand "Warning Days - (Soft)/Hard" 
| eval _time = coalesce(strptime('Warning Days - (Soft)/Hard', "(%B %d, %Y)"), strptime('Warning Days - (Soft)/Hard', "%B %d,  %Y")) 
| eval daysAgo = (now() - _time) / (24 *60 * 60) 
| search daysAgo &amp;lt;= 7 
| stats values("Warning Days - (Soft)/Hard") AS "Warning Days - (Soft)/Hard" BY Pool |mvexpand "Warning Days - (Soft)/Hard"  |stats count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 26 Mar 2017 15:07:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290690#M13493</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2017-03-26T15:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of license pool violations using REST...</title>
      <link>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290691#M13494</link>
      <description>&lt;P&gt;Sooooooooo, now taking it to the next level, is there a way to do a search for each pool, and have this report on each one, in a similar fashion, rather than a search for each pool?&lt;/P&gt;</description>
      <pubDate>Sun, 26 Mar 2017 15:09:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290691#M13494</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2017-03-26T15:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of license pool violations using REST...</title>
      <link>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290692#M13495</link>
      <description>&lt;P&gt;Like this (BE SURE TO NOTE THAT I CHANGED STUFF IN THE MIDDLE, TOO!):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest splunk_server=local /services/licenser/messages 
| where (category=="license_window" OR category=="pool_over_quota") AND create_time &amp;gt;= now() - (30 * 86400) 
| rename pool_id AS pool 
| eval warning_day=if(category=="pool_over_quota","(".strftime(create_time,"%B %e, %Y").")",strftime(create_time-43200,"%B %e, %Y")) 
| fields pool warning_day 
| appendpipe 
    [ rest splunk_server=local /services/licenser/slaves 
    | mvexpand active_pool_ids 
    | eval slave_name=label 
    | eval pool=active_pool_ids 
    | fields pool slave_name 
    | stats values(slave_name) as "members" by pool] 
| appendpipe 
    [ rest splunk_server=local /services/licenser/pools 
    | eval pool=title 
    | eval quota=if(isnull(effective_quota),quota,effective_quota) 
    | eval quotaGB=round(quota/1024/1024/1024,3) 
    | fields pool stack_id, quotaGB] 
| stats first(pool) as "Pool" first(stack_id) as "Stack ID" first(members) as "Current Members" first(quotaGB) as "Current Quota (GB)" values(warning_day) AS "Warning Days - (Soft)/Hard" by pool 
| fields - pool 

| rename COMMENT AS "search Pool = FMD License"

| mvexpand "Warning Days - (Soft)/Hard" 
| eval _time = coalesce(strptime('Warning Days - (Soft)/Hard', "(%B %d, %Y)"), strptime('Warning Days - (Soft)/Hard', "%B %d,  %Y")) 
| eval daysAgo = (now() - _time) / (24 *60 * 60) 
| search daysAgo &amp;lt;= 7 
| stats count BY Pool
| eventstats sum(count) AS TotalAllPools
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Be sure to click &lt;CODE&gt;Accept&lt;/CODE&gt; to close the question.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Mar 2017 17:32:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290692#M13495</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-26T17:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of license pool violations using REST...</title>
      <link>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290693#M13496</link>
      <description>&lt;P&gt;Thanks.  Accepted answer. &lt;/P&gt;</description>
      <pubDate>Sun, 26 Mar 2017 18:33:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290693#M13496</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2017-03-26T18:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of license pool violations using REST...</title>
      <link>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290694#M13497</link>
      <description>&lt;P&gt;Hey kids, don't be shy with the 'pow' function of eval.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;round(quota/1024/1024/1024,3)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;could be:&lt;BR /&gt;
&lt;CODE&gt;round( quota / pow( 1024 , 3 ) , 3 )&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Whichever is easier to read.&lt;/P&gt;

&lt;P&gt;Anyway, this is amazing! Great work!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 12:42:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-count-the-number-of-license-pool-violations-using-REST/m-p/290694#M13497</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2017-03-28T12:42:27Z</dc:date>
    </item>
  </channel>
</rss>

