Custom reports using script
Use the script, statistic.py to collect statistics about the enabled Billing Data Server (BDS) metrics, including details about what data was processed, the number of events, event peak times, and message sizes for each metric, for a day or range of days that you can specify. The script gathers information from transform files, and saves it into CSV output files in a local directory; a configuration parameter allows you to specify the output directory, and, beginning with release 9.0.001.01, to control the reporting interval (weekly, monthly, quarterly, or yearly). The script is available in release 9.0.000.33 and later.
How the script works
The script is available in the brs/bds_statistic directory, and accepts the following syntax: statistic.py [-sd <start date>] [-ed <end date> / -w / -m / -q / -y] where:
- -sd is the start date (YYYY-MM-DD*), representing the first day from which to gather statistics. For example, -sd 2020-02-01. If no value is specified, the script uses the transform watermark minus one day.
- *The format required for this parameter varies depending on the reporting interval you optionally specify in -ed. If you do not specify a value for -sd, BDS uses defaults: if you have previously generated daily statistics, it uses 2020-05-02 as the start date, otherwise it calculates the start date as transform_watermark - 1 day.
- -ed is the end date (YYYY-MM-DD) representing the last day from which to gather statistics. For example, -ed 2020-02-08. If no value is specified, the script uses the transform watermark. If you do not specify a value for -ed, BDS uses the transform watermark as the end date. Beginning with release 9.0.001.01, you can optionally specify one of the following parameters to aggregate peak usage data based on the corresponding reporting interval:
- -w — generates a weekly file with a name containing the start date, for example, for the week beginning July 1, 2020: 2020-07-01_07.csv. If you use this parameter, specify a value for -sd using the format YYYY-MM-DD — BDS generates data for the day you specify, plus six subsequent days.
- -m — generates a monthly file with a name containing a numerical value representing the month, for example, for July 2020: 2020-07.csv. If you use this parameter, specify a value for -sd using the format YYYY-MM.
- -q # — where # is the quarter on which to report (1-4). Generates a quarterly file with a name containing a numerical value representing the month, for example, for the second quarter of 2020: 2020-Q2.csv. If you use this parameter, specify a value for -sd using the format YYYY.
- -y — generates an annual file with a name containing a numerical value representing the year, for example: 2020.csv. If you use this parameter, specify -sd using the format YYYY.
- For example:
- [genesys@ef04ae121e57 genesys]$ python /genesys/brs/bds_statistic/statistic.py -sd 2020-06-01 -ed 2020-07-15
- [genesys@ef04ae121e57 genesys]$ python /genesys/brs/bds_statistic/statistic.py -sd 2020-07-01 -ed 2020-07-08 -w
- [genesys@ef04ae121e57 genesys]$ python /genesys/brs/bds_statistic/statistic.py -sd 2020-07-01 -ed 2020-07-08 -m
- [genesys@ef04ae121e57 genesys]$ python /genesys/brs/bds_statistic/statistic.py -sd 2020 -ed 2020-07-08 -q 2
- [genesys@ef04ae121e57 genesys]$ python /genesys/brs/bds_statistic/statistic.py -sd 2020 -ed 2020-07-08 -y
The script uses the directories described in the following table:
Directory | Path | Description |
---|---|---|
transform | globals/premise/local_cache/transform | The local directory where the script looks for transform files generated by BDS. Configure the globals/premise/local_cache/transform parameter in config.json to specify the location of this directory. |
statistic_tenant |
|
The local directory where files generated by the metric statistic script are stored. Configure the BDS_OVERRIDE_STATISTIC_LOG_FILE and BDS_OVERRIDE_STATISTIC_RESULT_DIR parameters (in .env file) to specify this path. |
Tenant | /genesys/log/statistic/tenant/ | The local directory where reporting-period-specific files (weekly, monthly, quarterly, or yearly), generated by the metric statistic script, are stored.
Beginning with release 9.0.001.05, tenant statistics are saved to a separate directory for each period (day, week, and so on), for example:
./statistic/tenant/<Tenant_name>/day/<list of daily files> |
Resulting data files
The script generates a dated file in a folder below /genesys/log/statistic/..., for example:
- /genesys/log/statistic/tenant/TenantDEMO/2020-02-02.csv
For a brief description on the report output columns, see Report result fields