Table Creation Commands for Apinizer Logs
This document defines the tables intended for storing traffic and audit records using the “DB Connector”. To ensure functionality with the DB Connector, it is recommended to use the tables defined below. These tables are designed to ensure that traffic and audit records are stored securely and consistently in the database.
Important
When creating a table, if you have to choose a column type that is not available in your database, you should consider alternatives. For example, it is recommended to use 'CLOB' instead of 'LONGTEXT' in Oracle, as indicated in the table below. You should make the right choice taking into account the needs of your application and the current database configuration.
Log Fields | MySQL/MariaDB | Oracle |
---|---|---|
Unsent Message | CREATE TABLE UnsentMessage ( | CREATE TABLE UnsentMessage ( id VARCHAR2(255) PRIMARY KEY, created TIMESTAMP, connectorId VARCHAR2(50), content CLOB ); |
Audit Event | CREATE TABLE AuditEvent ( id VARCHAR(255) PRIMARY KEY, auditEventDate TIMESTAMP, principal VARCHAR(255), state VARCHAR(255), objectId VARCHAR(255), objectName VARCHAR(255), referenceObjectJson LONGTEXT, projectId VARCHAR(255), className VARCHAR(255) ); | CREATE TABLE AuditEvent ( id VARCHAR2(255) PRIMARY KEY, auditEventDate TIMESTAMP, principal VARCHAR2(255), state VARCHAR2(255), objectId VARCHAR2(255), objectName VARCHAR2(255), referenceObjectJson CLOB, projectId VARCHAR2(255), className VARCHAR2(255) ); |
Application | CREATE TABLE ApplicationLog ( id VARCHAR(255) PRIMARY KEY, env_name VARCHAR(255), api_proxy_id VARCHAR(255), api_proxy_name VARCHAR(255), correlation_id VARCHAR(255), created TIMESTAMP, level VARCHAR(255), message TEXT, stack_trace TEXT, host_name VARCHAR(255), enum_application_log VARCHAR(255), total_duration INT ); | CREATE TABLE ApplicationLog ( id VARCHAR2(255) PRIMARY KEY, env_name VARCHAR2(255), api_proxy_id VARCHAR2(255), api_proxy_name VARCHAR2(255), correlation_id VARCHAR2(255), created TIMESTAMP, level VARCHAR2(255), message CLOB, stack_trace CLOB, host_name VARCHAR2(255), enum_application_log VARCHAR2(255), total_duration NUMBER ); |
Token Traffic | CREATE TABLE ApiProxyTokenTrafficLog ( id VARCHAR(255) PRIMARY KEY, created TIMESTAMP, apinizerCorrelationId VARCHAR(255), environmentId VARCHAR(255), projectId VARCHAR(255), applicationId VARCHAR(255), applicationName VARCHAR(255), apiProxyId VARCHAR(255), apiProxyName VARCHAR(255), xForwardedFor VARCHAR(255), httpRequestRemoteAddress VARCHAR(255), httpRequestHttpMethod VARCHAR(255), httpRequestContentType VARCHAR(255), usernameOrKey VARCHAR(255), timeTotal INTEGER, statusCode INTEGER, errorType VARCHAR(255), parentErrorType VARCHAR(255), resultType VARCHAR(255), toClientHeader TEXT, toClientBody TEXT, authTokenType VARCHAR(255), audience VARCHAR(255), clientInfo VARCHAR(255), tokenNeverExpires BOOLEAN, issuedAt TIMESTAMP, expiresAt TIMESTAMP, expiresIn INTEGER, scope VARCHAR(255), refreshTokenAllowed BOOLEAN, refreshTokenIssuedAt TIMESTAMP, refreshTokenExpiresAt TIMESTAMP, refreshTokenExpiresIn INTEGER, refreshCount INTEGER, maxRefreshCount INTEGER ); | CREATE TABLE ApiProxyTokenTrafficLog ( id VARCHAR2(255) PRIMARY KEY, created TIMESTAMP, apinizerCorrelationId VARCHAR2(255), environmentId VARCHAR2(255), projectId VARCHAR2(255), applicationId VARCHAR2(255), applicationName VARCHAR2(255), apiProxyId VARCHAR2(255), apiProxyName VARCHAR2(255), xForwardedFor VARCHAR2(255), httpRequestRemoteAddress VARCHAR2(255), httpRequestHttpMethod VARCHAR2(255), httpRequestContentType VARCHAR2(255), usernameOrKey VARCHAR2(255), timeTotal NUMBER, statusCode NUMBER, errorType VARCHAR2(255), parentErrorType VARCHAR2(255), resultType VARCHAR2(255), toClientHeader CLOB, toClientBody CLOB, authTokenType VARCHAR2(255), audience VARCHAR2(255), clientInfo VARCHAR2(255), tokenNeverExpires VARCHAR2(5), issuedAt TIMESTAMP, expiresAt TIMESTAMP, expiresIn NUMBER, scope VARCHAR2(255), refreshTokenAllowed VARCHAR2(5), refreshTokenIssuedAt TIMESTAMP, refreshTokenExpiresAt TIMESTAMP, refreshTokenExpiresIn NUMBER, refreshCount NUMBER, maxRefreshCount NUMBER ); |
Api Proxy Traffic | CREATE TABLE ApiProxyTrafficLog ( location_lat DOUBLE, location_lon DOUBLE ); | CREATE TABLE ApiProxyTrafficLog ( id VARCHAR2(255) PRIMARY KEY, created TIMESTAMP, apinizer_correlation_id VARCHAR2(255), environment_id VARCHAR2(255), project_id VARCHAR2(255), application_id VARCHAR2(255), application_name VARCHAR2(255), api_proxy_id VARCHAR2(255), api_proxy_name VARCHAR2(255), enum_api_type VARCHAR2(255), api_proxy_relative_path VARCHAR2(255), api_proxy_method_id VARCHAR2(255), api_proxy_method_name VARCHAR2(255), x_forwarded_for VARCHAR2(255), username_or_key VARCHAR2(255), http_request_context_path VARCHAR2(255), http_request_remote_address VARCHAR2(255), http_request_http_method VARCHAR2(255), http_request_content_type VARCHAR2(255), http_request_path_info VARCHAR2(255), http_request_query_string VARCHAR2(255), http_request_remote_user VARCHAR2(255), http_request_requested_session_id VARCHAR2(255), http_request_request_uri VARCHAR2(255), http_request_character_encoding VARCHAR2(255), http_request_content_length NUMBER, http_request_protocol VARCHAR2(255), http_request_scheme VARCHAR2(255), http_request_server_name VARCHAR2(255), http_request_server_port NUMBER, http_request_remote_host VARCHAR2(255), http_request_remote_port NUMBER, http_request_local_name VARCHAR2(255), http_request_local_addr VARCHAR2(255), http_request_local_port NUMBER, from_client_read_only_parameter CLOB, from_client_read_only_header CLOB, from_client_read_only_body CLOB, to_backend_api_parameter CLOB, to_backend_api_header CLOB, to_backend_api_body CLOB, routing_address VARCHAR2(255), routing_retry_count NUMBER, routing_failover_count NUMBER, from_backend_api_read_only_header CLOB, from_backend_api_read_only_body CLOB, to_client_header CLOB, to_client_body CLOB, time_request_pipeline_total NUMBER, time_response_pipeline_total NUMBER, time_routing_total NUMBER, time_api_proxy_total NUMBER, size_request_total NUMBER, size_response_total NUMBER, cache_hit VARCHAR2(5), status_code NUMBER, error_type VARCHAR2(255), parent_error_type VARCHAR2(255), result_type VARCHAR2(255), location_lat DOUBLE, location_lon DOUBLE ); |