Skip to content

Commit 9f752a8

Browse files
[DNS] Add info about getting account DNS analytics (#23426)
* Add intro sentence about account-level info available via API * Add query examples and use cases under API section * Separate zone and account limits in plans/index.json * Make query examples open by default * Use graphql code bolck and add graphql-api-explorer
1 parent 0ab0226 commit 9f752a8

File tree

2 files changed

+73
-6
lines changed

2 files changed

+73
-6
lines changed

src/content/docs/dns/additional-options/analytics.mdx

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar:
66

77
---
88

9-
import { FeatureTable } from "~/components"
9+
import { FeatureTable, Details } from "~/components"
1010

1111
When you use Cloudflare DNS, you can access data about DNS queries through a variety of sources.
1212

@@ -18,6 +18,8 @@ DNS analytics allow you to evaluate data about DNS queries to your zone.
1818

1919
You can [use the dashboard](#view-on-the-dashboard) to get insights quickly based on a [predefined set of dimensions](#available-dimensions), or [use the API](#explore-with-the-api) to have access to all fields available in the GraphQL DNS analytics schemas.
2020

21+
When using GraphQL, you also have the option to get data for DNS queries across all zones within a given Cloudflare account.
22+
2123
### Availability and limits
2224

2325
<FeatureTable id="dns.dns_analytics" />
@@ -66,10 +68,60 @@ The DNS analytics has two [schemas](/analytics/graphql-api/getting-started/query
6668
* `dnsAnalyticsAdaptive`: Retrieve information about individual DNS queries.
6769
* `dnsAnalyticsAdaptiveGroups`: Get reports on aggregate information only.
6870

71+
To get account-level data, you can set up queries similar to the following:
72+
73+
<Details header="Get the last 10,000 queries resulting in NXDOMAIN" open = {true}>
74+
75+
```graphql graphql-api-explorer
76+
query GetLastNXDOMAINResponses {
77+
viewer {
78+
accounts(filter: { accountTag: "83a4527361bcdec24566fd7f837b6de5" }) {
79+
dnsAnalyticsAdaptive(
80+
limit: 10000
81+
filter: {
82+
date_geq: "2025-06-16",
83+
responseCode: "NXDOMAIN",
84+
date_leq: "2025-06-18"
85+
}
86+
orderBy: [datetime_DESC]
87+
) {
88+
zoneTag
89+
queryName
90+
responseCode
91+
queryType
92+
datetime
93+
}
94+
}
95+
}
96+
}
97+
```
98+
</Details>
99+
100+
<Details header="Get the overall query count per account" open = {true}>
101+
102+
```graphql graphql-api-explorer
103+
query GetTotalDNSQueryCount {
104+
viewer {
105+
accounts(filter: { accountTag: "83a4527361bcdec24566fd7f837b6de5" }) {
106+
dnsAnalyticsAdaptiveGroups(
107+
filter: {
108+
date_geq: "2025-05-01"
109+
date_leq: "2025-05-30"
110+
}
111+
limit: 1
112+
) {
113+
count
114+
}
115+
}
116+
}
117+
}
118+
```
119+
</Details>
120+
69121
---
70122

71123
## Logs
72124

73125
Logs let Enterprise customers view [detailed information](/logs/reference/log-fields/zone/dns_logs/) about individual DNS queries.
74126

75-
For help setting up Logpush, refer to [Get started with Logs](/logs/get-started/).
127+
For help setting up Logpush, refer to [Get started with Logs](/logs/get-started/).

src/content/plans/index.json

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,20 +690,35 @@
690690
"biz": "Yes",
691691
"ent": "Yes"
692692
},
693-
"maximum_duration": {
694-
"title": "Maximum time interval",
693+
"maximum_duration_zone": {
694+
"title": "Maximum time interval (zone)",
695695
"free": "7 days",
696696
"pro": "31 days",
697697
"biz": "31 days",
698698
"ent": "62 days"
699699
},
700-
"historical_data": {
701-
"title": "Historical data",
700+
"maximum_duration_account": {
701+
"title": "Maximum time interval (account)",
702+
"free": "7 days",
703+
"pro": "7 days",
704+
"biz": "7 days",
705+
"ent": "62 days"
706+
},
707+
"historical_data_zone": {
708+
"title": "Historical data (zone)",
702709
"free": "8 days",
703710
"pro": "31 days",
704711
"biz": "31 days",
705712
"ent": "62 days"
713+
},
714+
"historical_data_account": {
715+
"title": "Historical data (account)",
716+
"free": "8 days",
717+
"pro": "8 days",
718+
"biz": "8 days",
719+
"ent": "62 days"
706720
}
721+
707722
}
708723
},
709724
"dnssec": {

0 commit comments

Comments
 (0)