Consolidations

Consolidations take the new data that’s been inserted into the temporary _log table and combine it into the main table. The terms consolidation query and scheduled queries can be used interchangeably.

Consolidations.__init__(api, preview_changes=True, apply_changes=False, pprint_indent=2, pprint_width=250, pprint_depth=5)
Consolidations are Alooma’s way of making sure only the most recent row for each table appears in the main table.
Consolidation management the v2 API. The class is initiated with the following variables:
Parameters:
  • api – The Alooma API client authentication
  • preview_changes – Prints the consolidation or consolidations changes if True
  • apply_changes – Executes the consolidation changes if True
  • pprint_indent – The indent value to pprint dictionaries
  • pprint_width – The width value to pprint dictionaries
  • pprint_depth – The depth value to pprint dictionaries

Get Schedule Queries

Consolidations.get_scheduled_queries()

Gets the list of scheduled queries from Alooma

Returns:The JSON response with all of the scheduled queries

Scheduled Query Table

Consolidations.scheduled_query_table()

Retrieves a list of the consolidation queries running in Alooma. Prints the information in a dataframe if the class preview_changes flag is True.

Returns:A dataframe with the information on the scheduled queries

Create Consolidation

Consolidations.create_consolidation(event_name, cron_schedule='*/15 * * * *', custom_variables=False)

Create Consolidation Given Configuration

Parameters:
  • event_name – The event type for which to create the consolidation
  • cron_schedule – The cron schedule on which to run the schedule query. Default is 15 minutes.
  • custom_variables – custom variables to add to consolidation. For consolidations from database tables set custom variables to None. For consolidations for all other tables the recommended customer variable settings are custom_variables = {“all_ri_fields”: [“_metadata.@timestamp”], “ri_field”: “_metadata.@timestamp”, “ri_column”: “_metadata.@timestamp”}

Get Scheduled Query For Event

Consolidations.get_scheduled_query_for_event(event_name)

Gets the scheduled query for a specific event

Parameters:event_name – The name of the event for which to retrieve the schedule query
Returns:Returns the schedule query

View Schedule Query For Event

Consolidations.view_schedule_query_for_event(event_name, show_configuration_only=True)

Prints the scheduled query for an event when

Parameters:
  • event_name – The event to view a scheduled query for
  • show_configuration_only – Print the configuration only without the query
Returns:

The scheduled query

Remove Schedule Query

Consolidations.remove_scheduled_query(schquery)

Removes the scheduled query for a specific ID

Parameters:schquery – the ID of a schedule query to remove
Returns:None

Remove Scheduled Query For Event

Consolidations.remove_scheduled_query_for_event(event_name, show_configuration_only=True)

Removes the scheuled query for an event

Parameters:
  • event_name – The name of the event for which to remove the consolidation
  • print_consolidations – print the current consolidation
  • show_configuration_only – Print the configuration only without the query
  • apply_change – apply the remove consolidation
Returns:

Change Scheduled Query Frequency For Event

Consolidations.change_scheduled_query_frequency_for_event(event_name, cron_schedule='*/15 * * * *')

Change the frequency of the scheduled query

Parameters:
  • event_name – he name of the event for which to remove the consolidation
  • cron_schedule – The new cron schedule to set for the event
Returns:

None