Effective Log Search & Analytics 概要

Prev Next

概要

NAVERクラウドプラットフォームは、NAVERの最新コンピューティング技術や運用ノウハウが蓄積されたクラウドサービスです。
NAVERクラウドプラットフォームが提供する様々な商品群のうち、ソリューション商品を利用できるように提供するアプリケーションインターフェース(API)をNAVERクラウドプラットフォームAPIといいます。

Effective Log Search & Analytics APIはRESTfulの形で提供されます。

HTTP方式のGET/POSTメソッドの呼び出しにより実行されます。

共通の設定

API URL

https://elsa.apigw.ntruss.com/api/v1/

リクエストヘッダ

ヘッダ名 説明
x-ncp-apigw-timestamp 1970年1月1日 00:00:00 協定世界時(UTC)からの経過時間をミリセカンド(Millisecond)で表したもの
API Gatewayサーバとの時間差が5分以上の場合は無効なリクエストとみなす
x-ncp-iam-access-key NAVERクラウドプラットフォームで発行されたAPIキーまたはIAMで発行されたAccessKey
x-ncp-apigw-signature-v2 AccessKeyとマッピングするSecretKeyで暗号化した署名
HMAC暗号化アルゴリズムはHmacSHA256を使用

以下はJavaで「x-ncp-apigw-signature-v2」を作成する例です。詳細については以下の文書をご参照ください。

NAVERクラウドプラットフォームの認証キー及びSignature作成ガイドに移動

public String makeSignature() {
    String space = " ";                    // one space
    String newLine = "\n";                    // new line
    String method = "GET";                    // method
    String url = "/api/v1/fields?projectKey=Pbxxxxx_elsa-test&projectId=8171&from=1381190400000&to=1381190400000";    // url (include query string)
    String timestamp = "{timestamp}";            // current timestamp (epoch)
    String accessKey = "{accessKey}"            // access key id (from portal or sub account)
    String secretKey = "{secretKey}";

    String message = new StringBuilder()
        .append(method)
        .append(space)
        .append(url)
        .append(newLine)
        .append(timestamp)
        .append(newLine)
        .append(accessKey)
        .toString();

    SecretKeySpec signingKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA256");
    Mac mac = Mac.getInstance("HmacSHA256");
    mac.init(signingKey);

    byte[] rawHmac = mac.doFinal(message.getBytes("UTF-8"));
    String encodeBase64String = org.apache.commons.codec.binary.Base64.encodeBase64String(rawHmac);

  return encodeBase64String;
}

オペレーション

API名 説明
fields プロジェクト別のログフィールドを照会
search プロジェクト別のログを照会
download プロジェクト別のログをダウンロード