TengenceTengence
Product docs

Search Log Collection Policy

Configure the collection switch, sample rate, daily quota and retention for search access logs, and understand log fields, masking and truncation.

Log collection controls whether searches in this app leave an access log. Those logs are the raw material for slow-query analysis, request-level troubleshooting and query-volume checks. Collection does not change how search works or what results are returned.

You configure it under Current app → Log Collection in the console. Each app has its own policy: when you switch apps in the left sidebar, you see that app’s own switch and limits.

Tengence console Log Collection page showing the collection switch, sample rate, daily quota and retention days
Log collection settings: four parameters saved per app

What the policy controls

A log policy answers three questions:

  1. Whether to record: the collection switch must be on before any access log is written.
  2. How much to record: the sample rate keeps a random share of requests; the daily quota caps how many records can be written in one day.
  3. How long to keep it: retention days records the intended retention window for plan checks and operations reference.

It does not control search behavior. Turning collection off, lowering the sample rate or exhausting the quota never changes search results; it only stops new logs from being produced.

Collection switch

A new app starts with collection off and shows v0; the three parameters below the switch are not editable.

Turn the switch on to enable the sample rate, daily quota and retention fields. Once saved, the new policy applies to new requests immediately — no service restart and no index rebuild required.

When collection is off:

  • no new access logs are written;
  • logs already written are not deleted;
  • slow-query analysis receives no new data;
  • search requests themselves are unaffected.

Turning it back on starts recording from that point forward. Requests made while collection was off are not backfilled.

Sample rate

The sample rate randomly selects requests, from 0% to 100% in 1% steps.

  • 100%: full collection; every eligible request is logged.
  • 50%: roughly half of requests are logged, suitable for high-traffic apps that only need trends.
  • 0%: equivalent to off; no logs are written even if the switch is on.

Sampling is decided per request, not per user or per query. The same query may therefore be logged on some occurrences and skipped on others. For exact reproduction, temporarily set the rate back to 100%.

Lowering the sample rate reduces request counts and slow-query counts in reports proportionally. That is a sampling effect, not a drop in real traffic.

Daily quota

The daily quota caps how many log records can be written per day. It is measured in records, with a minimum of 1; leave it blank for no limit.

  • The quota counts records that pass sampling, not all incoming requests.
  • Once the cap is reached, later requests are not collected until the counter resets at midnight.
  • The quota is a soft limit: it affects log volume only, and never makes a search request fail or return an error.

Use the quota to control storage cost and abnormal traffic. Set it somewhat above a normal day’s volume to leave room for promotions or spikes. If the cap is hit every day, slow-query analysis will lose the later part of each day’s traffic.

Retention days

Retention accepts 1–180 days. Leave it blank to use the plan default.

Note: the current version saves and displays this value with the policy, but does not automatically delete written logs when the retention period ends. Actual retention is still governed by the platform’s storage policy. To shorten retention, purge historical logs or change the storage period, contact platform support; changing the number in this field alone is not enough.

What one access log contains

One record corresponds to one request in the search pipeline. The main fields are:

Field Description
request_id Identifier for the request; reused if supplied by the caller, otherwise generated and returned in the response header
log_time When the log was written, to the millisecond
app_id / device_id / user_id App identifier plus device and user identifiers supplied by the caller
api / method / url Request path, HTTP method and full URL
query / query_hash Query text and a digest of it; query text is capped at 512 characters
page / size / filters / sortFields Pagination, filters and sort conditions
status / error_code / error_msg / http_status Business status, error code, error message and HTTP status
took_ms / stage_json Total latency and per-stage latency
total_hits / result_count Total matches and the number of results returned
request_json / response_json Request and response snapshots, truncated at the size limits
debug_json Diagnostic details attached when debug mode is on

Logs are attributed by app. A request whose app cannot be identified is not logged, which is why the switch can be on yet no logs appear.

Masking and truncation

Three request-side fields are masked: the query, the URL and the request body.

  • Mainland China mobile numbers become 1**********.
  • Email addresses become ***@***.

Response bodies are not masked; they are stored as-is up to the truncation limit. The device_id and user_id request headers are also kept as-is. Do not put phone numbers, emails, ID numbers or other sensitive data into searchable fields, and do not treat log masking as a substitute for data governance at the index layer.

Every field has a fixed limit. Anything beyond it is truncated, and the truncated field lists which parts were cut:

Content Limit
Query text 512 characters
Request body 8 KB
Response body 32 KB
Debug details 32 KB
Response capture 64 KB; the rest is still returned to the caller but not logged

When a response exceeds 64 KB, the log extracts only the status code and error message from the beginning of the body instead of parsing the full JSON. If you need the complete response for troubleshooting, keep a sample in your own application rather than relying on the access log.

Saving and versioning

The version starts at v0 and increments by one on every save. If the version does not change after saving, the policy was not persisted.

A save overwrites the app’s existing policy; it does not create a second policy alongside it. Use the version number to confirm the change landed, then check the next day’s report data against the new settings.

Three common setups

Scenario Switch Sample rate Daily quota Retention
First integration, validating the pipeline On 100% No limit 30 days
Steady state, controlling cost On 20% Set to an acceptable volume Plan default
Incident investigation On 100% Temporarily unlimited 7 days
  • For first integration, run at full volume for 1–2 days, confirm fields and reports, then lower the rate.
  • In steady state, use sampling for trends and slow-query distribution while keeping a useful investigation window.
  • After an incident investigation, restore the normal rate and quota to avoid unnecessary cost.

Higher sampling is not automatically better. Estimate daily request volume first, then choose a rate that fits an acceptable log volume. If traffic is already low, full collection is the better choice for troubleshooting.

Impact of turning collection off

Turning collection off does not slow search or cause errors, but it reduces observability:

  • slow-query analysis gets no new data, so latency distribution and slow-query sources cannot be assessed;
  • request failures lack request_id, latency and stage details, leaving only application-side logs;
  • query volume, zero-result rate and other log-based metrics develop gaps;
  • existing reports remain, but their latest date stops at the day before collection was turned off.

If log volume is the concern, lower the sample rate or set a daily quota rather than switching collection off.

Pre-launch checklist

  1. Confirm the correct app is selected. Policies are isolated per app and never apply across apps.
  2. Confirm collection is on and the version has incremented.
  3. Confirm the sample rate is not 0% and that the chosen share matches your intent.
  4. Confirm the daily quota is above normal daily volume; setting it too low loses the later part of the day.
  5. Confirm retention is between 1 and 180 days; check your plan if you need a longer window.
  6. Send a real search and confirm it returns normally; check the next day that slow-query analysis shows the corresponding data.
  7. Check that phone numbers and emails in the query are masked, and that sensitive data is not placed in searchable index fields.

FAQ

The switch is on, but no logs appear

First check that the sample rate is not 0% and that the daily quota has not been reached. Then confirm the request carries an app identifier; requests without one are skipped. Finally, confirm the request actually went through the search pipeline rather than only calling a console API.

The version number did not change after saving

The save did not persist. Check for an error on the page and whether the current account has permission to configure this app, then save again. The version number is the most direct evidence that the policy was stored.

Report data dropped after I lowered the sample rate

That is expected. Sampling applies per request, and reports count only sampled logs. For exact reproduction, temporarily set the rate back to 100%, reproduce the issue, then restore the previous rate.

Does the next day make up for requests skipped after the quota was reached?

No. The quota resets by calendar day. It only affects the remaining requests that day; the next day starts counting from zero and does not backfill skipped requests.

I changed retention days, but old logs are still there

The current version does not delete historical logs based on this value. It is saved with the policy, but actual cleanup follows the platform’s storage policy. Contact platform support if you need immediate cleanup.

Phone numbers or emails still appear in logs

Query text, URLs and request bodies have phone numbers and emails masked; response bodies do not. If sensitive data appears in a response body or an index field, fix it at the index and response layer rather than relying on log masking.

Does turning collection off affect search performance?

No. Collection is a side path after search completes. Turning it off only removes that write; search latency and results stay the same.

Related docs

On this page