LoginSignup
7
4

More than 1 year has passed since last update.

【Logging】VercelのAxiomのメリット【アクセスログ】

Last updated at Posted at 2022-11-30

Vercelはログを保存しない

image.png

Vercelのロギングようわからん

選択肢が多すぎてどれ使えばええん?

image.png

  • GraphJSON
  • Axiom
  • Logtail
  • Logalert
  • Sematext Logs
  • Logflare
  • Datadog

Log Drainsを自作してみる

ログドレインを自作しようとしたが、レビューが必須みたい。Personal Account TokenでPOSTしてもダメだった

image.png

自作すればWebhookでログを取得できるようだ

image.png

静的ファイルやラムダやエッジ関数やrewritesのログができる

image.png

とりま新しそうなAxiomを使ってみる

Add Integrationをクリッククリックで導入だ

image.png

Axiomのメリット

500GB無料で収集できて直近30日分保存できる

他のインテグレーションよりよさげ

image.png

API経由でログを取得できる。リアルタイムでも

アクセスログが表示できる。開発者ツールでネットワーク見るとAPI経由で取得している

image.png

API Tokenを作成してAPI経由でログをすべて取得できる

image.png

curl 'https://cloud.axiom.co/api/v1/datasets/vercel/query?streaming-duration=1s&nocache=false' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer '$API_TOKEN \
  -d '{
    "resolution": "auto",
    "startTime": "1970-01-01T00:00:00.000Z",
    "endTime": "2262-04-11T23:47:16.000Z",
    "limit": 5,
    "order": [
        {
            "field": "_time",
            "desc": true
        }
    ],
    "includeCursor": true
}'

image.png

ドキュメントが充実

可視化の機能が強力

while true; do curl https://.vercel.app; sleep 1; done

image.png

BigQueryライクにクエリ実行できる

image.png

いい感じのダッシュボードが用意されている。30日ログを保持していることが分かる

cloud.axiom.co_hellowork-den8_dashboards_vercel (1).png

閾値を超えたらアラートメールやSlack通知、Discord通知も可能

image.png
image.png

7
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
4