Ana içeriğe geç

Traffic Log Settings

Endpoints

MethodPathDescription
GET/apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/List all environments' settings
GET/apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/Get specific environment settings
PUT/apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/Update environment settings
PUT/apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/connectors/{connectorType}/methodOverride/?methodName={methodName}Update method-level override
DELETE/apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/connectors/{connectorType}/methodOverride/?methodName={methodName}Delete method-level override

Update Method-Level Connector Override

See Update Method-Level Override.

PUT /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/connectors/{connectorType}/methodOverride/?methodName={methodName}

Delete Method-Level Connector Override

See Delete Method-Level Override.

DELETE /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/connectors/{connectorType}/methodOverride/?methodName={methodName}

List All Environments' Settings

Endpoint

GET /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name
apiProxyNamestringYesAPI Proxy name
methodNamestringConditionalAPI method name (only for method-level endpoints)
connectorTypestringConditionalConnector type (only for method-level endpoints). Values: ELASTICSEARCH_INDEX, DB_INSERT_UPDATE_DELETE, SYSLOG_SEND, WEBHOOK_SEND, RABBITMQ_SEND, ACTIVEMQ_SEND, KAFKA_SEND, GRAYLOG_SEND, LOGBACK_APPEND

GET: List All Environments' Settings

Returns traffic log settings for all environments of the specified API Proxy. Connector keys are returned as connection names (not internal UUIDs).

cURL Example

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/trafficLogSettings/" \
-H "Authorization: Bearer YOUR_TOKEN"

GET: Specific Environment Settings

Returns traffic log settings for a single environment.

cURL Example

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/trafficLogSettings/production/" \
-H "Authorization: Bearer YOUR_TOKEN"

PUT: Update Environment Settings

Updates traffic log settings for a specific environment and deploys the changes.

Request Body Example

{
"logParamRequestFromClient": true,
"logHeaderRequestFromClient": true,
"logBodyRequestFromClient": true,
"logParamRequestToTarget": true,
"logHeaderRequestToTarget": true,
"logBodyRequestToTarget": true,
"logHeaderResponseFromTarget": true,
"logBodyResponseFromTarget": true,
"logHeaderResponseToClient": true,
"logBodyResponseToClient": true,
"connectorSettingsMap": {
"my-elasticsearch-connection": {
"enabled": true,
"logHeaderRequestFromClient": true,
"logBodyRequestFromClient": true,
"logBodyResponseFromTarget": true,
"enableMetadataIdentification": true,
"enableMetadataApiProxy": true,
"enableMetadataRequest": true,
"enableMetrics": true,
"enableMetadataResponse": true,
"enableSentAddress": true,
"enableBodyFromClientSize": true,
"sizeBodyFromClient": 2048,
"enableBodyToTargetSize": true,
"sizeBodyToTarget": 2048,
"enableBodyFromTargetSize": true,
"sizeBodyFromTarget": 2048,
"enableBodyToClientSize": true,
"sizeBodyToClient": 2048,
"enablePrivacy": false,
"privacyDefinitionList": []
},
"my-kafka-connection": {
"enabled": true,
"logBodyRequestFromClient": true,
"logBodyResponseFromTarget": true
}
}
}

Request Body Fields (Top-Level)

FieldTypeRequiredDefaultDescription
logParamRequestFromClientbooleanNotrueLog query parameters from client request
logHeaderRequestFromClientbooleanNotrueLog headers from client request
logBodyRequestFromClientbooleanNotrueLog body from client request
logParamRequestToTargetbooleanNotrueLog query parameters sent to target
logHeaderRequestToTargetbooleanNotrueLog headers sent to target
logBodyRequestToTargetbooleanNotrueLog body sent to target
logHeaderResponseFromTargetbooleanNotrueLog headers from target response
logBodyResponseFromTargetbooleanNotrueLog body from target response
logHeaderResponseToClientbooleanNotrueLog headers sent to client response
logBodyResponseToClientbooleanNotrueLog body sent to client response
connectorSettingsMapobjectNoPer-connector settings. Key = connection name (as defined in Connections). See below.
methodOverrideListarrayNo[]Method-level connector overrides. See below.

connectorSettingsMap

The connectorSettingsMap is an object where each key is the connection name and each value contains the connector-specific log settings.

Important: The connection must already exist and be configured as a connector (recipient) in the target environment. Use the Connections API to create connections first.

Connector Log Settings Fields

FieldTypeRequiredDefaultDescription
enabledbooleanNofalseEnable/disable this connector
logParamRequestFromClientbooleanNonullOverride: log query params from client
logHeaderRequestFromClientbooleanNonullOverride: log headers from client
logBodyRequestFromClientbooleanNonullOverride: log body from client
logParamRequestToTargetbooleanNonullOverride: log query params to target
logHeaderRequestToTargetbooleanNonullOverride: log headers to target
logBodyRequestToTargetbooleanNonullOverride: log body to target
logHeaderResponseFromTargetbooleanNonullOverride: log headers from target
logBodyResponseFromTargetbooleanNonullOverride: log body from target
logHeaderResponseToClientbooleanNonullOverride: log headers to client
logBodyResponseToClientbooleanNonullOverride: log body to client
enableMetadataIdentificationbooleanNonullLog identification metadata
enableMetadataApiProxybooleanNonullLog API proxy metadata
enableMetadataRequestbooleanNonullLog request metadata (IP, method, path, etc.)
enableMetricsbooleanNonullLog performance metrics (timing, size, retry)
enableMetadataResponsebooleanNonullLog response metadata (status code, error type)
enableSentAddressbooleanNonullLog routing address
enableBodyFromClientSizebooleanNonullEnable size limit for client request body
sizeBodyFromClientintegerNonullMax character count for client request body
enableBodyToTargetSizebooleanNonullEnable size limit for target request body
sizeBodyToTargetintegerNonullMax character count for target request body
enableBodyFromTargetSizebooleanNonullEnable size limit for target response body
sizeBodyFromTargetintegerNonullMax character count for target response body
enableBodyToClientSizebooleanNonullEnable size limit for client response body
sizeBodyToClientintegerNonullMax character count for client response body
enablePrivacybooleanNofalseEnable privacy masking
privacyDefinitionListarrayNo[]Privacy masking rules. Each item is a Privacy Definition object

Note: Fields set to null inherit from the parent (proxy-level defaults).

Privacy Definition Object

Each entry in privacyDefinitionList describes what to find (patternType and its companion field) and what to do with it (operation). Rules are applied to the four logged bodies (client request, target request, target response, client response) as well as to logged headers and parameters for element-name rules.

FieldTypeRequiredDefaultDescription
enabledbooleanNotrueSet to false to keep the rule but stop applying it
operationstringYes-MASK, DELETE, ENCRYPT, HASH or DETECT
patternTypestringNoELEMENT_NAMEELEMENT_NAME, REGEX or BUILTIN
elementNamestringConditional-Required for ELEMENT_NAME. JSON/XML field name, header name or form parameter name
regexPatternstringConditional-Required for REGEX. Java regular expression matched against the body text
builtInPiiTypestringConditional-Required for BUILTIN. One of TCKN, IBAN_TR, PHONE_TR, EMAIL, CREDIT_CARD
maskModestringNoFIXEDMask shape when operation = MASK: FIXED, KEEP_FIRST, KEEP_LAST, MASK_FIRST
maskPatternstringNo***With FIXED, the full replacement text. With the partial shapes, its first character is used as the mask character (default *).
maskVisibleCharCountintegerNo4Characters kept (or masked, with MASK_FIRST) in the partial shapes

Choosing a pattern type

  • ELEMENT_NAME — matches by field name, regardless of the value. Use it when the sensitive data always lives in a known field (password, cardNumber). This is the only type that also covers logged headers and query parameters.
  • REGEX — matches by value anywhere in the body. Use it for formats specific to your APIs (order codes, internal identifiers). Patterns are compiled once and guarded against catastrophic backtracking; a pattern that fails the guard is skipped rather than allowed to stall the gateway.
  • BUILTIN — matches by value using an Apinizer-maintained pattern for a known PII type. Use it when the data can appear in any field, or in free text such as an AI prompt.

Built-in types are checksum-validated. TCKN, IBAN_TR and CREDIT_CARD are verified after the pattern matches (TCKN check digits, IBAN mod-97, Luhn). A value that looks right but fails validation is deliberately left unmasked — this keeps ordinary 11-digit numbers, order totals and reference codes from being destroyed in your logs. If a real value is not being masked, check that it is a valid number first.

DETECT does not modify content. It reports that PII was present without changing the logged body. The other four operations rewrite the matched value: MASK replaces it according to the mask shape below, DELETE removes it, HASH stores a one-way hash, ENCRYPT stores a reversible encrypted value.

Mask shape. maskMode decides how a MASK match is rewritten, and applies the same way to all three pattern types:

maskModeInputOutput
FIXED (default)05321234567***
KEEP_FIRST, count 4053212345670532*******
KEEP_LAST, count 405321234567*******4567
MASK_FIRST, count 405321234567****1234567

The default replaces the whole value and leaks nothing. The partial shapes preserve the output length and deliberately leave part of the value visible — since the remaining fragment can identify a person on its own, choose one on purpose. If maskVisibleCharCount is greater than or equal to the value length nothing would be masked at all; in that case it falls back to replacing the whole value.

{
"enablePrivacy": true,
"privacyDefinitionList": [
{
"enabled": true,
"patternType": "BUILTIN",
"builtInPiiType": "TCKN",
"operation": "MASK"
},
{
"enabled": true,
"patternType": "ELEMENT_NAME",
"elementName": "password",
"operation": "DELETE"
},
{
"enabled": true,
"patternType": "REGEX",
"regexPattern": "ORD-\\d{6}",
"operation": "HASH"
}
]
}
Note

Privacy rules on this endpoint apply to traffic logs only — they change what is written to Elasticsearch, Kafka and the other log connectors, not what the gateway sends to the client or the backend. To mask data in the request or response itself, use the AI PII Mask policy or a transformation policy.

cURL Example: Enable Elasticsearch and Kafka Logging

curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/trafficLogSettings/production/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"logHeaderRequestFromClient": true,
"logBodyRequestFromClient": true,
"logBodyResponseFromTarget": true,
"connectorSettingsMap": {
"my-elasticsearch-connection": {
"enabled": true,
"logBodyRequestFromClient": true,
"logBodyResponseFromTarget": true,
"enableBodyFromClientSize": true,
"sizeBodyFromClient": 1024
},
"my-kafka-connection": {
"enabled": true,
"logBodyRequestFromClient": true
}
}
}'

cURL Example: Minimal — Enable Only Elasticsearch

curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/trafficLogSettings/tester/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"connectorSettingsMap": {
"my-elasticsearch-connection": {
"enabled": true
}
}
}'
Note

PUT response keys: The PUT response's connectorSettingsMap keys are connector UUIDs (or legacy EnumExecutableType names), not resolved to connection names. GET responses resolve UUID keys to connection names.


PUT: Method-Level Connector Override

Adds or updates a method-level connector override. This allows different log settings for specific API methods. methodName is a query parameter (not a path segment), so method names that contain / work correctly.

Full reference: Update Method-Level Override.

Path

PUT /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/connectors/{connectorType}/methodOverride/?methodName={methodName}

Request Body

Same as Connector Log Settings Fields above.

cURL Example

curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/trafficLogSettings/production/connectors/ELASTICSEARCH_INDEX/methodOverride/?methodName=/pets" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"logBodyRequestFromClient": false,
"logBodyResponseFromTarget": true,
"enableBodyFromTargetSize": true,
"sizeBodyFromTarget": 512
}'

DELETE: Method-Level Connector Override

Removes a method-level connector override, reverting to proxy-level settings.

Full reference: Delete Method-Level Override.

Path

DELETE /apiops/projects/{projectName}/apiProxies/{apiProxyName}/trafficLogSettings/{environmentName}/connectors/{connectorType}/methodOverride/?methodName={methodName}

cURL Example

curl -X DELETE \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/trafficLogSettings/production/connectors/ELASTICSEARCH_INDEX/methodOverride/?methodName=/pets" \
-H "Authorization: Bearer YOUR_TOKEN"

Response

Success Response (200 OK)

{
"status": "SUCCESS",
"resultList": [
{
"environmentId": "env-123",
"apiProxyId": "proxy-456",
"logParamRequestFromClient": true,
"logBodyRequestFromClient": true,
"connectorSettingsMap": {
"my-elasticsearch-connection": {
"enabled": true,
"logBodyRequestFromClient": true
}
}
}
]
}

Error Response (400 Bad Request)

{
"status": "FAILURE",
"resultMessage": "Connection with name 'non-existent-connection' not found in the environment!"
}

Common Error Messages

MessageCause
Connection with name 'X' not found in the environment!Connection name is not present in the target environment's recipient list (no matching connector configured for that environment)
environmentName value can not be empty!Missing environment name
Environment (X) is not found!Environment does not exist
Method (X) is not found in ApiProxy!Method name does not exist in the API proxy
Invalid connectorType: XInvalid EnumExecutableType value

Notes and Warnings

  • Connection Names: Use the connection name as the key in connectorSettingsMap, not the connection type or ID. The API resolves names to internal IDs automatically.
  • Environment Recipient: The connection must be added as a connector (recipient) in the target environment before it can be used here.
  • Inheritance: null fields in connector settings inherit from proxy-level defaults. Method-level overrides inherit from proxy-level connector settings.
  • Trailing Slash: All URLs must end with /. Without it, you will get a 404 error.
  • Deploy: PUT operations automatically deploy the changes to the environment.

Permissions

User must have API_MANAGEMENT + VIEW permission for GET endpoints and API_MANAGEMENT + MANAGE permission for PUT/DELETE endpoints.