{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/ja/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Apache アクセスログインポート連携","description":"Apache アクセスログを Treasure Agent (td-agent) で簡単にクラウドにインポートする方法を解説します。設定手順と注意点を詳しく説明します。","siteUrl":"https://docs.treasure.ai","lang":"en-US","jsonLd":{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.treasure.ai/","name":"Treasure AI","url":"https://www.treasure.ai/","logo":"https://www.treasure.ai/hubfs/assets/images/logos/primary-logo.svg"},{"@type":"WebSite","@id":"https://docs.treasure.ai/#website","name":"Treasure AI Documentation","url":"https://docs.treasure.ai/","inLanguage":["en","ja"],"publisher":{"@id":"https://www.treasure.ai/"}}]},"llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"apache-アクセスログインポート連携","__idx":0},"children":["Apache アクセスログインポート連携"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Treasure Agent (td-agent) から Apache ログを追跡して、アクセスログをクラウドに継続的にインポートできます。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"td-agent-のインストール","__idx":1},"children":["td-agent のインストール"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["アプリケーションサーバーに td-agent をインストールします。td-agent は、あらゆる種類の時系列データのストリーミングアップロード専用のデーモンプログラムです。td-agent は、Treasure Data が Fluentd プロジェクトの下で保守しているオープンソースプロジェクトです。td-agent は、Treasure Data 用のカスタムプラグインで Fluentd を拡張しています。"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.fluentd.org/download"},"children":["Install Fluentd"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"td-agentconf-の変更","__idx":2},"children":["td-agent.conf の変更"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apikey"]}," オプションを設定して認証キーを指定します。API キーは Treasure コンソール から確認できます。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ファイルを変更するには、",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/etc/td-agent/td-agent.conf"]}," にアクセスします。td-agent.conf ファイルで ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apikey"]}," オプションを設定します。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"em","attributes":{},"children":["YOUR_API_KEY"]}," は実際の API キー文字列に置き換えてください。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"conf","header":{"controls":{"copy":{}}},"source":"# Tailing the Apache Log\n<source>\n  type tail\n  path /var/log/httpd-access.log\n  pos_file /var/log/td-agent/httpd-access.pos\n  tag td.production.access\n  format apache2\n</source>\n\n# Treasure Data Input and Output\n<match td.*.*>\n  type tdlog\n  endpoint api.treasuredata.com\n  apikey YOUR_API_KEY\n  auto_create_table\n  buffer_type file\n  buffer_path /var/log/td-agent/buffer/td\n  use_ssl true\n</match>\n","lang":"conf"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["以下の行が設定されたら、エージェントを再起動します。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ sudo /etc/init.d/td-agent restart\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["td-agent はログを追跡し続け、ログをバッファリングし (",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["var/log/td-agent/buffer/td"]},")、自動的にログをクラウドにアップロードします。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"データインポートの確認","__idx":3},"children":["データインポートの確認"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["SIGUSR1 シグナルを送信すると、td-agent のバッファがフラッシュされ、アップロードがすぐに開始されます。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"# generate access logs\n$ curl http://host:port/\n\n# flush the buffer\n$ kill -USR1 `cat /var/run/td-agent/td-agent.pid`\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["データが正常にアップロードされたことを確認するには、次のように ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td tables"]}," コマンドを実行します。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ td tables\n+------------+------------+------+-----------+\n| Database   | Table      | Type | Count     |\n+------------+------------+------+-----------+\n| production | access     | log  | 1         |\n+------------+------------+------+-----------+\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["正しく動作していない場合は、",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/var/log/td-agent.log"]}," を確認してください。",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td-agent:td-agent"]}," にログを読み取る権限が必要です。"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["td-agent はログローテーションを処理します"]},"。td-agent はログの最後の位置を記録し、td-agent プロセスがダウンした場合でも、各行が正確に 1 回だけ読み取られることを保証します。ただし、情報はファイルに保持されるため、ファイルが破損すると「正確に 1 回」の保証は崩れます。"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"次のステップ","__idx":4},"children":["次のステップ"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Treasure Data は、従来の RDBMS よりも柔軟なスキーマメカニズムを提供しています。クエリには、Hive Query Language を活用します。"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/databases/schema-management"},"children":["Schema Management"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/queries/hive/writing_hive_queries"},"children":["Writing Hive Queries"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/tools/cli-and-sdks/api-references-and-tool-references"},"children":["Programatic Access with REST API and its Bindings"]}]}]}]},"headings":[{"value":"Apache アクセスログインポート連携","id":"apache-アクセスログインポート連携","depth":1},{"value":"td-agent のインストール","id":"td-agent-のインストール","depth":1},{"value":"td-agent.conf の変更","id":"td-agentconf-の変更","depth":1},{"value":"データインポートの確認","id":"データインポートの確認","depth":1},{"value":"次のステップ","id":"次のステップ","depth":1}],"frontmatter":{"seo":{"title":"Apache アクセスログインポート連携","description":"Apache アクセスログを Treasure Agent (td-agent) で簡単にクラウドにインポートする方法を解説します。設定手順と注意点を詳しく説明します。"}},"lastModified":"2026-06-17T07:22:53.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/int/apache-access-logs-import-integration","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}