Data Sync - Create Data Sync Policy

URI

https://164.99.19.131:8443/SentinelRESTServices/datasync/policy

Supported Methods

POST

This creates a new data sync policy.

Authentication

Authentication Types
Sentinel Permissions Needed

Supported Formats

Request

Response

URL Parameters

None.

Success Codes

Fault Codes

Request Data

Object type: Data sync policy object
Information about the data sync policy
FieldRequiredDescription
alwaysSchedulefalseBoolean flag specifying whether data syncing is to run continuously ("true") or according to a schedule ("false"). If "false", the <B>ScheduleItems<B> field specifies the schedule to be used for syncing data.
backOffPeriodfalseThe number of seconds to backoff between queries when the synced-to time is up to date.
countColumnfalseColumn in destination table where event counts are to be stored. The type of this column should be capable of storing an integer.
dbConnectionConfigfalseThis is a nested JSON <B>&lt;Database Connection&gt;</B> object that specifies the destination database to sync data to. It is used in conjunction with the <B>table</B> field to specify the destination table events are to be synced to. See below for description of fields in Database Connection objects.
doSummariesfalseBoolean flag specifying whether this policy creates event summary records instead of syncing individual events. If this field is not present, it defaults to false - i.e., the policy is NOT a summary policy. If true, then the <B>summaryPeriod</B>, <B>countColumn</B>, <B>timeColumn</B>, and <B>summaryKeyColumn</B> fields will aos contain information.
enabledfalseBoolean flag specifying whether the policy is enabled or not.
filterfalseThe Lucene filter specifying which events are to be synced.
maxBatchSizefalseThe maximum number of events to write to the destination database in a single transaction. NOTE: A transaction may exceed this size if it is required to sync all of the events in a particular time boundary in a single transaction
maxEPSSizefalseThe maximum number of events per second to sync. (NOTE: This is not currently used)
policyNamefalseName of data sync policy. NOTE: The policy name must be unique. If it is not unique, the create policy call will fail.
retentionPeriodfalseThe number of days to retain synced data. If missing, or zero, data will not be deleted. Otherwise, it will be deleted after the specified number of days
ScheduleItemsfalseIf the <B>alwaysSchedule</B> field is "false", this is a nested JSON object that specifies the schedule to use for doing data sync. Note that it contains a single internal field <B>scheduleItem</B> that is an array of <B>&lt;Schedule Item&gt;</B> objects. See below for description of fields in Schedule Item objects.
startSyncTimefalseThis is the time that the data sync started from. It is specified in milliseconds since midnight, January 1, 1970 (UTC).
summaryKeyColumnfalseColumn in destination table that holds a special summary key. The type of this column should be a VARCHAR capable of storing a 36 character UUID. This column is used internally when it is necessary to update a summary record. NOTE: This column should be indexed for performance reasons.
summaryPeriodfalseNumber of minutes to summarize events over. All events having a common set of event fields (as specified in the <B>TableColumnMap</B> field) will be counted over time periods of this length. A single record with a count of events found during the time period will be stored in the destination table. NOTE: This must be a positive number. If omitted, or the value is <= 0, the policy will be treated as a normal data sync policy - i.e., it will NOT produce summaries.
syncInternalEventsfalseBoolean flag indicating whether or not to sync internal events.
tablefalseThis is a nested JSON <B>&lt;Table&gt;</B> object that specifies the destination table events are to be synced to. See below for description of fields in Table objects.
TableColumnMapfalseThis is a nested JSON object that specifies the mappings between event fields and destination table columns. Note that it contains a single internal field <B>ColumnMap</B> that is an array of <B>&lt;Column Map&gt;</B> objects. See below for description of fields in Column Map objects.
timeColumnfalseColumn in destination table where event time will be stored. Event time for a summary record is defined to be the time at the beginning of the summary period. For example, if the summary period is two minutes, then event times would potentially fall on every two minute boundary (such as 12:00, 12:02, 12:04, etc). The count would be the count of all events which occurred starting from that time for the duration of the summary. If the time column contained a time of 12:02, then the summary record contains a count is for all events that occurred between >= 12:02 and < 12:04 (note it is exclusive of 12:04). NOTE: This column should be indexed for performance reasons.

Request Data

Object type: Data sync schedule item
Information about the data sync schedule for this policy
FieldRequiredDescription
dayOfWeekfalseDay of the week data sync should occur in. 0=Sunday, 1=Monday, etc. -1=Every Day
durationfalseNumber of minutes the data sync should last. 1 through 1440 (number of minutes in a day)
startHourfalseHour of the day the data sync should start. 0 through 23.
startMinutefalseMinute of the hour the data sync should start. 0 through 59.

Request Data

Object type: Database connection object
Information about the connection to the database where the data sync data is to be stored
FieldRequiredDescription
databasefalseName of database.
dbPlatformfalseType of database. Valid values are: "postgresql", "oracle11g", and "mssql2008".
hostNamefalseName or IP address of host where database resides.
passwordfalsePassword of database user.
portfalsePort number for communication with database system.
userNamefalseUser name of database user to login to database.

Request Data

Object type: Database table object
Information about the database table where the data sync data is to be stored
FieldRequiredDescription
schemaNamefalseName of the schema for the destination table. NOTE: This is an optional field. It will default to the schema of the database user specified in the database connection information.
tableNamefalseName of the destination table.

Request Data

Object type: Data sync column mapping object
Information about how the lucene fields map to the database fields
FieldRequiredDescription
columnNamefalseName of column in the database that the event field is to be stored in.
columnSizefalseSize of database column. NOTE: This only applies if the database column is a VARCHAR.
columnTypefalseData type of database column. Should be a java.sql.Types value (BIGINT, VARCHAR, etc.).
eventFieldfalseName of event field that is to be synced. NOTE: These are the names of the event fields as specified <a target="_top" href="http://www.novell.com/developer/event_schema.html">here</a> in the <B>Tag Name</B> column.
nullablefalseFlag indicating whether database column can have null values. 0=Nulls not allowed, 1=Nulls allowed, 2=Unknown if nulls allowed.

Response Data

Object type: Data sync policy object
Information about the newly created data sync policy
FieldDescription
alwaysScheduleBoolean flag specifying whether data syncing is to run continuously ("true") or according to a schedule ("false"). If "false", the ScheduleItems field specifies the schedule to be used for syncing data.
backOffPeriodThe number of seconds to backoff between queries when the synced-to time is up to date. This should be the value that was specified for the create request.
countColumnColumn in destination table where event counts are to be stored. The type of this column should be capable of storing an integer.
dbConnectionConfigThis is a nested JSON <B>&lt;Database Connection&gt;</B> object that specifies the destination database to sync data to. It is used in conjunction with the <B>table</B> field to specify the destination table events are to be synced to. See above for description of fields in Database Connection objects. This should be whatever was specified for the create request.
doSummariesBoolean flag specifying whether this policy should do event summaries instead of syncing individual events. If this field is not present, it defaults to false - i.e., the policy is NOT a summary policy. If true, then the <B>summaryPeriod</B>, <B>countColumn</B>, <B>timeColumn</B>, and <B>summaryKeyColumn</B> fields must also be supplied.
enabledBoolean flag specifying whether the policy is enabled or not. NOTE: It is possible for a policy to NOT be enabled even if the REST request specified that it should be. The policy may not be enabled if the destination database or destination table cannot be accessed.
filterThe Lucene filter specifying which events are to be synced.
forReportingThis is a flag that indicates whether the data sync policy is associated with a report. It should be false - this REST api is NOT allowed to create a data sync policy and associate it with a report.
idThis is the UUID of the newly created data sync policy.
maxBatchSizeThe maximum number of events to write to the destination database in a single transaction. This should be the value that was specified for the create request. NOTE: A transaction may exceed this size if it is required to sync all of the events in a particular time boundary in a single transaction.
maxEPSSizeThe maximum number of events per second to sync. This should be the value that was specified for the create request.
policyNameName of data sync policy.
retentionPeriodThe number of days to retain data before deleting it. If missing, or if it contains a value <= 0, data is not deleted. This should be the value that was specified for the create request.
ScheduleItemsIf the <B>alwaysSchedule</B> field is "false", this is a nested JSON object that specifies the schedule to use for doing data sync. Note that it contains a single internal field <B>scheduleItem</B> that is an array of <B>&lt;Schedule Item&gt;</B> objects. See above for description of fields in Schedule Item objects. This should be whatever was specified for the create request.
startSyncTimeThis is the time that the data sync will be started from. It is specified in milliseconds since midnight, January 1, 1970 (UTC). This should be whatever was specified for the create request.
summaryKeyColumnColumn in destination table that holds a special summary key. The type of this column should be a VARCHAR capable of storing a 36 character UUID. This column is used internally when it is necessary to update a summary record. NOTE: This column should be indexed for performance reasons.
summaryPeriodNumber of minutes to summarize events over. All events having a common set of event fields (as specified in the <B>TableColumnMap</B> field) will be counted over time periods of this length. A single record with a count of events found during the time period will be stored in the destination table. NOTE: This must be a positive number. If omitted, or the value is <= 0, the policy will be treated as a normal data sync policy - i.e., it will NOT produce summaries.
syncInternalEventsBoolean flag indicating whether or not to sync internal events. This should be the value that was specified for the create request.
tableThis is a nested JSON <B>&lt;Table&gt;</B> object that specifies the destination table events are to be synced to. See above for description of fields in Table objects. This should be whatever was specified for the create request.
TableColumnMapThis is a nested JSON object that specifies the mappings between event fields and destination table columns. Note that it contains a single internal field <B>ColumnMap</B> that is an array of <B>&lt;Column Map&gt;</B> objects. See above for description of fields in Column Map objects. This should be whatever was specified for the create request.
timeColumn Column in destination table where event time will be stored. Event time for a summary record is defined to be the time at the beginning of the summary period. For example, if the summary period is two minutes, then event times would potentially fall on every two minute boundary (such as 12:00, 12:02, 12:04, etc). The count would be the count of all events which occurred starting from that time for the duration of the summary. If the time column contained a time of 12:02, then the summary record contains a count is for all events that occurred between >= 12:02 and < 12:04 (note it is exclusive of 12:04). NOTE: This column should be indexed for performance reasons.

Sample Request

POST /datasync/policy
Data Sync Policy Fields&#10;{&#10;   "policyName": "My Data Sync Policy",&#10;   "enabled": "true",&#10;   "filter": "sev:[3 TO 5]",&#10;   "syncInternalEvents": "false",&#10;   "lagTime": "10",&#10;   "retentionPeriod": "90",&#10;   "partitionTable": "false",&#10;   "backOffPeriod": "60",&#10;   "maxEPSSize": "1000",&#10;   "maxBatchSize": "100",&#10;   "alwaysSchedule": "false",&#10;   "ScheduleItems": { "scheduleItem": [{&lt;Schedule Item&gt;},{&lt;Schedule Item&gt;}...]},&#10;   "dbConnectionConfig":{&lt;Database Connection&gt;},&#10;   "table": {&lt;Table&gt;},&#10;   "fieldMappingStatus": {&lt;Field Mapping Status&gt;},&#10;   "TableColumnMap": { "ColumnMap": [{&lt;Column Map&gt;},{&lt;Column Map&gt;} ....]}&#10;   "doSummaries": "false",&#10;   "summaryPeriod": "0",&#10;   "countColumn": "summary_count",&#10;   "timeColumn": "summary_time",&#10;   "summaryKeyColumn": "summary_key",&#10;   "startSyncTime": "1288177541000",&#10;   "forReporting": "false"&#10;}&#10;&#10;Schedule Item Fields&#10;&#10;{&#10;   "dayOfWeek": "0",&#10;   "startHour": "11",&#10;   "startMinute": "23",&#10;   "duration": "120"&#10;}&#10;&#10;Database Connection Fields&#10;&#10;{&#10;   "hostName": "164.99.19.125",&#10;   "port": "5432",&#10;   "database": "SIEM",&#10;   "userName": "appuser",&#10;   "password": "star1111",&#10;   "dbPlatform": "postgresql",&#10;}&#10;&#10;Table Fields&#10;{&#10;   "schemaName": "my_schema",&#10;   "tableName": "my_event_table"&#10;}&#10;&#10;Field Mapping Status Fields&#10;&#10;{&#10;   "tableStatus": "2",&#10;   "InvalidMappings": {"columnMap":[{&lt;Column Map&gt;},{&lt;ColumnMap&gt;}...]}&#10;}&#10;&#10;Column Map Fields&#10;&#10;{&#10;   "eventField": "msg",&#10;   "columnName": "msg",&#10;   "columnType": "12",&#10;   "nullable": "1",&#10;   "columnSize": "4000"&#10;}&#10;
Sample Response for application/json
Status: 200
{&#10;   "id": "102B21D0-BE9B-102D-83DB-001A6B6D3CF6",&#10;   "policyName": "My Data Sync Policy",&#10;   "enabled": "true",&#10;   "filter": "sev:[3 TO 5]",&#10;   "syncInternalEvents": "false",&#10;   "lagTime": "10",&#10;   "retentionPeriod": "90",&#10;   "partitionTable": "false",&#10;   "backOffPeriod": "60",&#10;   "maxEPSSize": "1000",&#10;   "maxBatchSize": "100",&#10;   "alwaysSchedule": "false",&#10;   "ScheduleItems": { "scheduleItem": [{&lt;Schedule Item&gt;},{&lt;Schedule Item&gt;}...]},&#10;   "dbConnectionConfig":{&lt;Database Connection&gt;},&#10;   "table": {&lt;Table&gt;},&#10;   "fieldMappingStatus": {&lt;Field Mapping Status&gt;},&#10;   "TableColumnMap": { "ColumnMap": [{&lt;Column Map&gt;},{&lt;Column Map&gt;} ....]}&#10;   "doSummaries": "false",&#10;   "summaryPeriod": "0",&#10;   "countColumn": "summary_count",&#10;   "timeColumn": "summary_time",&#10;   "summaryKeyColumn": "summary_key",&#10;   "startSyncTime": "1288177541000",&#10;   "forReporting": "false"&#10;}&#10;