How to obtain the License Consumption Report information directly from the database?
In order to get the license consumption data, you can check the information located in the PagesWriteOffLog and StatisticPagesWriteOff tables.
The PagesWriteOffLog table stores page write-offs for the current day.
When the day ends, the data for them are summarized and moved to the StatisticPagesWriteOff table, and these records are deleted from the PagesWriteOffLog table.
Note, that StatisticPagesWriteOff will not contain today's pages included. Today's page consumption data will only be present in the PagesWriteOffLog.
The writing-off of the data for these tables is disabled by default. Please recheck these settings if any of the tables mentioned above remain empty:
In order to enable License Consumption Reporting, you will need to add the line EnablePagesWriteOffLog to dbo.Settings:
[db_name]. [dbo]. [Settings]
Name = EnablePagesWriteOffLog
Value = True
TenantId = Null
By specifying the values in the TenantId field, you can adjust for which tenants to enable the setting:
- Null - for all tenants
- 0 - only for the default tenant
- 1 and further ascending - for tenant with the corresponding ID
After making these changes, you need to recycle the IIS pools.
The correct calculation algorithm will be to summarize the data from StatisticPagesWriteOff for the required period and add data from PagesWriteOffLog to them, but only for those days that are not in StatisticPagesWriteOff, because it is possible that the data has already been copied to StatisticPagesWriteOff, but not yet removed from PagesWriteOffLog.