const url = ' https://api.opdns.io/v1/profiles/example/logs?mode=tail&limit=100 ' ;
headers: {cookie: ' __Host-opdns_session=<__Host-opdns_session> ' }
const response = await fetch ( url , options );
const data = await response . json ();
--url ' https://api.opdns.io/v1/profiles/example/logs?mode=tail&limit=100 ' \
--cookie __Host-opdns_session=<__Host-opdns_session>
Token scope: logs:read. The log destination of the profile answers:
cloud and both: ClickHouse answers. The API answers 501
not_implemented when the server has no ClickHouse configured, and 504
query_timeout when a query runs too long.
self-hosted: the API relays the query to the node of the profile over the
link. It answers 503 node_offline with Retry-After when no node is
connected.
none: an empty result.
The result has the same shape for each of them. Analytics counts_by_status
and timeline are the exception (see /v1/profiles/{id}/analytics/{shape}).
device_name is the display name of the device when one is set
(PATCH /v1/profiles/{id}/devices/{deviceId}). Otherwise, it is the name that
the client sent.
Record columns, in order: ts, source, pop, node, profile_id,
device_id, device_name, client_ip, transport, qname, qtype,
status, reason_list_id, reason_rule, rcode, dnssec_validated,
cache_hit, latency_us, answer_ips, then four derived columns. The derived
columns are the same for ClickHouse and node results, for every node version:
reason (string): the list name when a list decided. Otherwise, the rule
or operator text as stored (denylist: *.example.com, rewrite: =nas.home,
legal_order LO-17). Empty when domain logging blanked a rule.
reason_code (string): list, rule, operator:<code> (legal_order,
abuse, csam), rewrite or none (allowed and failed queries).
ede_code (uint): the Extended DNS Error that the client received: 15 for
operator blocks, 17 for every other block, and 0 otherwise. The API does not
record the EDE of a failed upstream.
ede_text (string): the EDE extra text, which is the reason of a block.
A result is partial when the node answered with fewer rows than requested
because its query deadline was near. It is also partial when the node of the
profile is reconnecting (see QueryResult.partial).
Guardrails, per organization and api replica:
Each shape covers at most a fixed range, by plan. On free, search,
top_devices, destinations and top_pops cover 31 days, the hourly
shapes 400 days, and tail has no limit. A wider from..to gets 422
range_too_large. Without from, the range starts that long before to.
Queries draw on a cost budget of 1,200 units a minute: two units per day
of raw rows, and one unit per week of hourly totals.
At most four queries run at once. A query waits up to five seconds for a
slot, then gets 429 too_many_queries with Retry-After. A query over the
budget gets the same answer.
A cloud query that reads more rows or memory than the limit for one query
gets 422 query_too_expensive.
Public 6-character id. Never 000000.
string
/^[a-z0-9]{6}$/
mode
string
default: tail
Allowed values: tail search
from
string
Inclusive start, RFC 3339 or Unix milliseconds.
to
string
Exclusive end, RFC 3339 or Unix milliseconds. Default now.
device
Array<string>
Device id. Repeat for several.
status
Array<string>
Allowed values: allowed blocked rewritten error
qname
string
<= 253 characters
A substring match for search, and an exact name otherwise.
qtype
Array<integer>
Numeric DNS type. Repeat for several.
list
Array<integer>
Blocking list id. Repeat for several.
limit
integer
default: 100 >= 1 <= 1000
cursor
string
<= 512 characters
Opaque, from the next_cursor of a previous result.
Media type application/json
object The fixed query shapes that both ClickHouse and self-hosted nodes implement.
string
Allowed values: tail search counts_by_status top_domains top_devices top_blocked destinations timeline top_reasons top_owners top_pops
string
Allowed values: clickhouse node none
node
The node that answered, for source = node.
string format: uuid
Array<object>
object string
Allowed values: string int uint float bool time bytes unknown
One array per row, cells in column order. Time as RFC 3339, bytes as base64, null for NULL.
Array<Array>
partial
Always sent (false when complete). True when there are fewer rows than the
full query gives. The node cut its answer short (partial_reason timeout
near its query deadline, or overload), or the node of a self-hosted
profile is reconnecting (node_reconnecting, no rows, and a tail keeps its
cursor). The rows in the result are valid, and next_cursor continues
after them.
boolean
partial_reason
Set when partial is true.
string
Allowed values: timeout overload node_reconnecting
Example "partial_reason" : " timeout "
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/bad_request " ,
"detail" : " The JSON in the request is not valid (unexpected end of JSON input). Correct the JSON and try again. " ,
"request_id" : " 5f2c9a0e7b1d4c38 "
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/unauthenticated " ,
"code" : " unauthenticated " ,
"detail" : " You are not signed in, or your sign-in ended. Sign in again to continue. " ,
"request_id" : " 5f2c9a0e7b1d4c38 "
Authenticated but not allowed: insufficient_scope, session_required, csrf_rejected, reauth_required (sign in again within five minutes), account_pending_deletion (the account is in its deletion cooling-off period), email_unverified (creating a profile before the email address is verified).
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/insufficient_scope " ,
"code" : " insufficient_scope " ,
"detail" : " This API token does not have the profiles:write scope that this request needs. Create a token with this scope, then try again. " ,
"required_scope" : " profiles:write " ,
"request_id" : " 5f2c9a0e7b1d4c38 "
Not found (also for resources of another organization).
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/not_found " ,
"detail" : " We did not find that. The link is wrong, or the item no longer exists. " ,
"request_id" : " 5f2c9a0e7b1d4c38 "
The API refused the query: validation_failed (a parameter is not valid), range_too_large (from..to is wider than the shape allows, and errors names from), or query_too_expensive (the query needs more rows or memory than the limit for one query, so narrow the range or add filters).
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/range_too_large " ,
"title" : " Unprocessable Content " ,
"code" : " range_too_large " ,
"detail" : " This view can cover at most 31 days. Choose a shorter time range (from and to). " ,
"message" : " at most 31 days before to "
"request_id" : " 5f2c9a0e7b1d4c38 "
Too many log queries of this organization are running, or it used all of its query budget (too_many_queries). Try again after Retry-After seconds.
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/too_many_queries " ,
"title" : " Too Many Requests " ,
"code" : " too_many_queries " ,
"detail" : " Too many searches are running for your organization now. Wait a few seconds, then try again. " ,
"request_id" : " 5f2c9a0e7b1d4c38 " ,
not_implemented (cloud log queries are not configured on this server) or shape_unsupported (the node is too old).
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/not_implemented " ,
"title" : " Not Implemented " ,
"code" : " not_implemented " ,
"detail" : " The query log is not available on this server, so there is nothing to show here. " ,
"request_id" : " 5f2c9a0e7b1d4c38 "
node_error: the node failed to answer.
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/node_error " ,
"detail" : " Your self-hosted node returned an error for this search: the node's log database is unavailable. Read the log of the node, or try again in a minute. " ,
"request_id" : " 5f2c9a0e7b1d4c38 "
node_offline: the logs of the profile are on a self-hosted node, and no node is
connected. node_busy: the node has too many queries in progress.
relay_unavailable. Try again after Retry-After (also retry_after in the body).
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/node_offline " ,
"title" : " Service Unavailable " ,
"detail" : " The self-hosted node that keeps the logs of this profile is offline. Make sure that the node is running and online, then try again. " ,
"request_id" : " 5f2c9a0e7b1d4c38 " ,
node_timeout: the node did not answer within 10 seconds. query_timeout: a cloud (ClickHouse) log query ran too long.
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/node_timeout " ,
"title" : " Gateway Timeout " ,
"detail" : " Your self-hosted node took too long to answer. Choose a shorter time range, or try again in a minute. " ,
"request_id" : " 5f2c9a0e7b1d4c38 "