Sponsored by Deepsite.site

mcp-server-google-logging

Created By
kazuhideoki8 months ago
Content

mcp-server-google-logging

前提

  • gcloud cli を使える
  • gcloud にログインしている
  • IAM で権限がある

要求

  • yaml で返す -> --format yaml
  • ログの内容は基本必要最低限。(クエリで調整可能)
    • 内容, リソース名, タイムスタンプ
  • 起動時パラメーター
    • プロジェクトID

ログを取得するための文脈

課題

プロジェクトのログに関する情報をどうやって取得するか? YS4B, 無印、戸建てで文脈が違う。ログの出力方法やドメイン知識が違う これをどのように反映させるのか?

アイデア

  • a. gcloud logging の MCP Server に resource として取得できるようにする
    • この場合、MCP Server として業務知識も持つ前提となってしまう -> OK
    • 内容: DBスキーマ、ログ、クエリのコツについての知識
  • b. 別の業務知識を取得するための MCP Server を作成する
    • 疎結合になって嬉しいが、管理が大変かも?

まず、a でやってみる。resource として取得できるようにする。

resource

  • OCPP関連
    • トランザクション、ステータス、接続状態
  • サービス関連
    • 予約
    • 利用ログ
    • 管理者

制限

  • select みたいにフィルタリングできない

gcloud でできること

ログ読み取り・表示

  • 🔵 gcloud logging read - 指定したフィルタ条件に合うログエントリーを読み取るんよ。- リソースタイプ、タイムスタンプ、ログレベル(severity)などを条件にできるし、複雑な条件も AND, OR で組み合わせられるんよ。- 出力形式は JSON やテーブル形式とか、gcloud の標準オプションで変更できるんよ。

リアルタイムログ監視

  • gcloud logging tail - ログが書き込まれるたびにリアルタイムで追いかけることができるんよ。

ログ一覧の表示・管理

  • gcloud logging logs list - プロジェクト内の全ログを一覧表示するんよ。
  • gcloud logging logs delete - 不要なログを削除する機能もあるんよ。ただし、削除は取り消せんけぇ注意が必要じゃけぇ。

ログバケットの管理

  • gcloud logging buckets list - ログを保存するバケットの一覧を表示するんよ。
  • gcloud logging buckets describe / update - 各バケットの詳細確認や、保持期間などの設定変更が可能なんよ。

ログシンクの管理

  • gcloud logging sinks list - ログを自動で Cloud Storage、BigQuery、Pub/Sub など外部の場所にエクスポートする先(シンク)の一覧を表示するんよ。
  • gcloud logging sinks create / update / delete - 新しいシンクを作ったり、既存のシンクの設定を変更、不要なシンクを削除するんよ。

ログベースのメトリクス管理

  • gcloud logging metrics list - ログから作成したメトリクスの一覧を表示するんよ。
  • gcloud logging metrics create / update / delete - 特定のログ条件に基づいてメトリクスを作成したり、変更、または削除するんよ。- これにより、モニタリングやアラートのトリガーに使えるんよ。

How to Use

Running the Server

You can run the server in two ways:

node -- /path/to/mcp-server-google-logging/dist/index.js --project=<project-id>

関連

gcloud CLI を使用したログエントリの書き込みとクエリ

サンプルプロンプト、メモ

ここ2時間で充電があった 充電器ID(chargePointId) と その充電時間をおしえて。
log_biz_dev をつかってログを調べて。まず docsで"OCPP" を確認してから調査して
充電時間は StatusNotification の status が Charging に切り替わり、次のステータスが切り替わるまで。
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Playwright McpPlaywright MCP server
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
CursorThe AI Code Editor
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Amap Maps高德地图官方 MCP Server
Tavily Mcp
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Serper MCP ServerA Serper MCP Server
WindsurfThe new purpose-built IDE to harness magic
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
ChatWiseThe second fastest AI chatbot™
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
DeepChatYour AI Partner on Desktop
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.