Audit rollup service is run as a deamon and rolls up daily table and create daily tables for future dates. Rollup service is started along with feeder service using audit-client script which is part of conduit-audit package. Both services are started using the same command
Implement rollup.sql packaged with the deb in the bin directory.
psql -h <host_name> -U <user_name> -d <db name> -f rollup.sql
Apart from the configurations needed to run feeder service, rollup service needs the below configurations to be mentioned in audit-feeder.properties file present in the conf path
Config | Required | Description | Possible values |
rollup.hour | Yes | The hour of day at which rollup service should start a run to rollup daily tables and create future daily tables | 0 to 23 |
rollup.intervallength.millis | No | The granularity of data at which the rollup has to happen. In daily table, all the entries with same keyhostname, cluster, tier, topic within a particular interval will be aggregated and added to rolled up (hourly_) tables as one entry. | any time interval length in milliseconds. Default is 3600000 (1 hour). |
rollup.checkpoint.dir | Yes | The path for rollup checkpoints to be read and marked | |
rollup.checkpoint.key | No | Checkpoint key name for rollup service | Default is rollupChkPt |
rollup.tilldays | Yes | The number of days before current day(when service is run) till when rollup of daily tables should happen and the value is an open upper boundary. If the value is set to n and current day is t , then tables till day t-n-1(included) will be rolled up, leaving n tables between current day and the last rolled up day without rollup | |
num.of.days.ahead.table.creation | Yes | The number of days ahead of today till when daily tables are to be created including current day. If value is set to n and current day is t, then t+1 will be created, from t to t+n |
Rolling up tables, creating daily tables, modifying checkpoint or checking if tables within a date range have been rolled up or created can be achieved by using admin option in audit-client script
Usage:
bin/audit-client admin -rollup -date <dd-mm-yyyy> [-n <number of days>] --conf <conf path>
Default value of number of days is 1
Example 1:
Consider the scenario when we are trying to rollup only one daily table i.e number of days is not mentioned, so default value 1 is picked up.Current date is 21-11-2013 and rollup.tilldays =1, so days after 19-11-2013 cannot be rolled up
bin/audit-client admin -rollup -date 17-11-2013 --conf conf/
-----------
SUCCESS
----------- audit_db=> \dt
List of relations Schema | Name | Type | Owner ---------------------------------------------------------- public | daily_conduit_summary | table | audit public | daily_conduit_summary20131116 | table | audit public | daily_conduit_summary20131117 | table | audit public | daily_conduit_summary20131118 | table | audit public | daily_conduit_summary20131119 | table | audit public | daily_conduit_summary20131120 | table | audit public | daily_conduit_summary20131121 | table | audit public | hourly_daily_conduit_summary20131116 | table | audit public | hourly_daily_conduit_summary20131117 | table | audit
Example 2:
Consider the scenario when number of days >1. If number of days = k, then tables from date to date+k-1 will be rolled up
bin/audit-client admin -rollup -date 18-11-2013 -n 2 --conf conf/ --------- SUCCESS ---------
audit_db=> \dt
List of relations Schema | Name | Type | Owner --------------------------------------------------------------------------------------------- public | daily_conduit_summary | table | audit public | daily_conduit_summary20131116 | table | audit public | daily_conduit_summary20131117 | table | audit public | daily_conduit_summary20131118 | table | audit public | daily_conduit_summary20131119 | table | audit public | daily_conduit_summary20131120 | table | audit public | daily_conduit_summary20131121 | table | audit public | hourly_daily_conduit_summary20131116 | table | audit public | hourly_daily_conduit_summary20131117 | table | audit public | hourly_daily_conduit_summary20131118 | table | audit public | hourly_daily_conduit_summary20131119 | table | audit
Usage:
bin/audit-client admin -create -date <dd-mm-yyyy> [-n <number of days>] --conf <conf path>
Default value of number of days is 1
Example 1:
Consider the scenario when we are trying to create only one daily table i.e number of days is not mentioned, so default value 1 is picked up
bin/audit-client admin -create -date 22-11-2013 --conf conf/ ---------- SUCCESS ----------
audit_db=> \dt
List of relations Schema | Name | Type | Owner -------------------------------------------------------------------------------------------- public | daily_conduit_summary | table | audit public | daily_conduit_summary20131116 | table | audit public | daily_conduit_summary20131117 | table | audit public | daily_conduit_summary20131118 | table | audit public | daily_conduit_summary20131119 | table | audit public | daily_conduit_summary20131120 | table | audit public | daily_conduit_summary20131121 | table | audit public | daily_conduit_summary20131122 | table | audit public | hourly_daily_conduit_summary20131116 | table | audit public | hourly_daily_conduit_summary20131117 | table | audit public | hourly_daily_conduit_summary20131118 | table | audit public | hourly_daily_conduit_summary20131119 | table | audit
Example 2:
Consider the scenario when number of days >1. If number of days = k, then daily tables from date to date+k-1 will be created
bin/audit-client admin -create -date 23-11-2013 -n 2 --conf conf/ ----------- SUCCESS -----------
audit_db => \dt
List of relations Schema | Name | Type | Owner ------------------------------------------------------------------------------ public | daily_conduit_summary | table | audit public | daily_conduit_summary20131116 | table | audit public | daily_conduit_summary20131117 | table | audit public | daily_conduit_summary20131118 | table | audit public | daily_conduit_summary20131119 | table | audit public | daily_conduit_summary20131120 | table | audit public | daily_conduit_summary20131121 | table | audit public | daily_conduit_summary20131122 | table | audit public | daily_conduit_summary20131123 | table | audit public | daily_conduit_summary20131124 | table | audit public | hourly_daily_conduit_summary20131116 | table | audit public | hourly_daily_conduit_summary20131117 | table | audit public | hourly_daily_conduit_summary20131118 | table | audit public | hourly_daily_conduit_summary20131119 | table | audit
Usage:
bin/audit-client admin -checkpoint -date <dd-mm-yyyy> --conf <conf path>
Example:
Consider the scenario when we want to mark checkpoint to date 21-11-2013 in IST TZ
bin/audit-client admin -checkpoint -date 21-11-2013 --conf conf/ ------------------ SUCCESS ------------------
cat ~/rollupChkPt/rollup.ck
1384972200000
Usage:
bin/audit-client admin -check -rolledup -date <dd-mm-yyyy> [-n <number of days to check>] --conf <conf path>
Example 1:
Consider the same db used in above examples and number of days to check is not passed, so default value 1 is picked up
bin/audit-client admin -check -rolledup -date 19-11-2013 --conf conf/ --------- SUCCESS ---------
bin/audit-client admin -check -rolledup -date 21-11-2013 --conf conf/ Table not rolled up for date: 21-11-2013 ------ FAIL ------
Example 2:
Consider the same db used in above examples and some value k is passed as number of days to check
bin/audit-client admin -check -rolledup -date 19-11-2013 -n 3 --conf conf/ Table not rolled up for date: 20-11-2013 Table not rolled up for date: 21-11-2013 ------ FAIL ------
Usage:
bin/audit-client admin -check -created -date <dd-mm-yyyy> [-n <number of days to check>] --conf <conf path>
Example 1:
Consider the same db used in above examples and number of days to check is not passed, so default value 1 is picked up
bin/audit-client admin -check -created -date 24-11-2013 --conf conf/ ------------ SUCCESS ------------
bin/audit-client admin -check -created -date 25-11-2013 --conf conf/ Table not created for date: 25-11-2013 ------------ FAIL ------------
Example 2:
Consider the same db used in above examples and some value k is passed as number of days to check
bin/audit-client admin -check -created -date 30-11-2013 -n 3 --conf conf/ Table not created for date: 30-11-2013 Table not created for date: 01-12-2013 Table not created for date: 02-12-2013 ------ FAIL ------