アプリケーション - ネットワーク
ネットワークログ
アプリケーションのドメインに対するリクエスト単位のエッジログを取得します。
GET
/
v2
/
apps
/
{app_id}
/
network
/
logs
ネットワークログ
curl --request GET \
--url https://api.squarecloud.app/v2/apps/{app_id}/network/logs \
--header 'Authorization: <authorization>'import requests
url = "https://api.squarecloud.app/v2/apps/{app_id}/network/logs"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.squarecloud.app/v2/apps/{app_id}/network/logs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.squarecloud.app/v2/apps/{app_id}/network/logs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.squarecloud.app/v2/apps/{app_id}/network/logs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.squarecloud.app/v2/apps/{app_id}/network/logs")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.squarecloud.app/v2/apps/{app_id}/network/logs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"status": "success",
"response": [
{
"timestamp": "2025-12-01T12:00:00.000Z",
"client": {
"ip": "203.0.113.45",
"country": "BR",
"location": "São Paulo",
"asn": "12345 - Example ISP",
"agent": "Mozilla/5.0",
"category": null
},
"request": {
"mitigated": false,
"method": "GET",
"host": "my-app.squareweb.app",
"path": "/api/users",
"query": "?limit=10",
"protocol": "HTTP/2",
"referer": null
},
"response": {
"status": 200,
"contentType": "application/json",
"cache": "MISS"
}
}
]
}
アプリケーションのプライマリドメインおよび設定済みのカスタムドメインに対する、リクエスト単位のエッジログ(HTTP、国、ステータス、バイト数)を返します。最大保持期間は7日間で、開始時刻はアプリケーションの作成日にクランプされます。
これは生のリクエスト単位のエッジトラフィックのサンプルであり、アプリケーション自体のランタイム出力ではありません。コンテナの stdout/stderr を確認するには、代わりにアプリケーションログの取得を参照してください。各エントリには、Cloudflare が観測した時点でのクライアント情報(IP、国、ユーザーエージェント)、リクエスト情報(メソッド、パス、クエリ、プロトコル)、レスポンス情報(ステータス、コンテンツタイプ、キャッシュ HIT/MISS)が含まれます。
結果はウェブサイトアナリティクスと同じ 5 分単位のバケットでキャッシュされるため、移動するウィンドウを繰り返しポーリングしても、呼び出しのたびにエッジから再取得するのではなくキャッシュされたサンプルが再利用されます。ネットワークエラーと組み合わせることで、5xx レスポンスの急増と、それを引き起こした具体的なリクエストを関連付けられます。
Pro および Enterprise プランでのみ利用できます。キャッシュミス時のレート制限: オーナーごとに60秒あたり10リクエスト。
パラメータ
string
必須
アプリケーションのID。アプリケーションのダッシュボードのURLで確認できます。
string
必須
ISO 8601 形式の開始タイムスタンプ。アプリケーションの作成日より前、または7日より古い時刻は指定できません。
string
必須
ISO 8601 形式の終了タイムスタンプ。
start より後である必要があります。レスポンス
string
呼び出しが成功したかどうかを示します。成功した場合は
success、失敗した場合は error です。array
レスポンスの内容。
表示 オブジェクトを切り替え
表示 オブジェクトを切り替え
string
ISO 形式のリクエストのタイムスタンプ。
object
object
{
"status": "success",
"response": [
{
"timestamp": "2025-12-01T12:00:00.000Z",
"client": {
"ip": "203.0.113.45",
"country": "BR",
"location": "São Paulo",
"asn": "12345 - Example ISP",
"agent": "Mozilla/5.0",
"category": null
},
"request": {
"mitigated": false,
"method": "GET",
"host": "my-app.squareweb.app",
"path": "/api/users",
"query": "?limit=10",
"protocol": "HTTP/2",
"referer": null
},
"response": {
"status": 200,
"contentType": "application/json",
"cache": "MISS"
}
}
]
}
一般的なエラー
| コード | HTTP | 説明 |
|---|---|---|
INVALID_TIME_RANGE | 400 | start/end が指定されていない、形式が不正、または時間範囲が逆転しています。 |
UPGRADE_REQUIRED | 403 | アナリティクスログは Pro および Enterprise プランでのみ利用できます。 |
UNABLE_TO_FETCH_ANALYTICS | 500 | エッジプロバイダーからのログ取得に失敗しました。 |
⌘I
ネットワークログ
curl --request GET \
--url https://api.squarecloud.app/v2/apps/{app_id}/network/logs \
--header 'Authorization: <authorization>'import requests
url = "https://api.squarecloud.app/v2/apps/{app_id}/network/logs"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.squarecloud.app/v2/apps/{app_id}/network/logs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.squarecloud.app/v2/apps/{app_id}/network/logs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.squarecloud.app/v2/apps/{app_id}/network/logs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.squarecloud.app/v2/apps/{app_id}/network/logs")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.squarecloud.app/v2/apps/{app_id}/network/logs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"status": "success",
"response": [
{
"timestamp": "2025-12-01T12:00:00.000Z",
"client": {
"ip": "203.0.113.45",
"country": "BR",
"location": "São Paulo",
"asn": "12345 - Example ISP",
"agent": "Mozilla/5.0",
"category": null
},
"request": {
"mitigated": false,
"method": "GET",
"host": "my-app.squareweb.app",
"path": "/api/users",
"query": "?limit=10",
"protocol": "HTTP/2",
"referer": null
},
"response": {
"status": 200,
"contentType": "application/json",
"cache": "MISS"
}
}
]
}

