Register custom audit events for billing

49 views Asked by At

We are running a custom app on Invantive Data Access Point which adds business functionality to Exact Online. For billing purposes, we would like to somehow register actual use of the software as defined in business terms instead of memory used, CPU, SQL statements executed, etc.

We do not yet have custom tables and I would like to keep it that way, so the whole state is kept in memory and in Exact Online only. So "insert into mytable@sqlserver..." is not an option. Neither does Exact Online offer the possibility to create custom tables as with Salesforce.

How can we somehow register billable events, such as "Performed an upload of 8 bank transactions" under this condition?

1

There are 1 answers

0
Guido Leenders On BEST ANSWER

For billing purposes, you can lift along on the Customer Service infrastructure, which is similar to functionality offered by AWS or Apple for this purpose in their eco system. The "table" which stores the billing events like a Call Detail Record of a PBX is managed by Customer Service infrastructure.

There are two options:

  • Your apps use the default audit and license event registrations like "User logged on", "First use of partition #xyz", etc. each with a specific message code like 'itgenlic125'.
  • Your apps define their own event types like "Performed an upload of bank transactions", with a message code 'mybillingmessagecode123' and the number '8' as quantity in the natural key.

The first option is automatically and always done. These data is also used to manage resource consumption and detect runaways.

The second option is best done using Invantive SQL with the data dictionary table "auditevents". All records inserted into auditevents are automatically asynchronously forwarded to Customer Service. To see the current register audit events since start of application:

select *
from   auditevents@datadictionary

where:

  • occurrence_date: when it happened.
  • logging_level: always "Audit".
  • message_code: code identifying the type of event.
  • data_container_d: ID of the data container, used with distributed SQL transactions.
  • partition: partition within the data container for platforms such as Exact Online or Microsoft SQL Server which store multiple databases under one customer/instance.
  • session_id: ID of the session.
  • user_message: actual text.
  • last_nk: last used natural key
  • application_name: name of the appplication.
  • application_user: user as known to the application.
  • gui_action: action within the GUI.
  • And some auditing and licensing information fields.

To register a custom event:

insert into auditevents@datadictionary select * from auditevents@datadictionary

Only some fields can be provided; the rest are automatically determined:

  • message_code
  • user_message
  • last_natural_key
  • application_name
  • application_user
  • gui_action
  • gui_module
  • partition
  • provider_name
  • reference_key
  • reference_table_code
  • session_id

To receive the billing events yourself from the infrastructure, you will need to access the Customer Service APIs or have them automatically forwarded to mail, Slack, RocketChat or Mattermost channel.

A sample SQL:

insert into auditevents@datadictionary
( message_code
, user_message
, last_natural_key
, application_name
, gui_action
, gui_module
, reference_key
, reference_table_code
, partition
)
select 'xxmycode001' message_code
,      'Processed PayPal payments in Exact Online for ' || divisionlabel user_message
,      'today' last_natural_key
,      'PayPalProcessor' application_name
,      'xx-my-paypal-processor-step-2' gui_action
,      'xx-my-payal-processor' gui_module
,      clr_id reference_key
,      'clr' reference_table_code
,      division partition
from   settings@inmemorystorage