fields

Prev Next

Overview

You can look up Effective Log Search & Analytics log fields by project.

Using this API, you can look up log fields that occur in a specified time period.
The field to which ".raw" is placed is behind /api/v1/logs/search when its sorts feature is used.

Request

API URL

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

Request header

The request headers specified in common settings are required.

Go to the creation guide of NAVER Cloud Platform authentication key and signature

x-ncp-apigw-timestamp: {current timestamp}
x-ncp-iam-access-key: {your iam access key}
x-ncp-apigw-signature-v2: {generated signature}

Request parameter

Parameter name Requirement status Type Restrictions Description
projectKey Yes string 1-53 Project key

Example:
"projectKey":"Pxxxxxx_test"
projectId Yes int Project Id

Example:
“projectId”:8181
from Yes int The timestamp at which to start the search (UTC milliseconds).

Example:
“from”:1381190400000
to Yes int The timestamp at which to end the search (UTC milliseconds).

Example:
“to”:1381190400000
### Request body
?projectKey=Pbxxxxx_elsa-test&projectId=8171&from=1381190400000&to=1381190400000

Request examples

import hashlib
import hmac
import base64
import time
import requests

def make_signature(access_key, secret_key, timestamp, url):
    timestamp = str(timestamp)
    secret_key = bytes(secret_key, 'UTF-8')
    method = "GET"

    message = method + " " + url + "\n" + timestamp + "\n" + access_key
    message = bytes(message, 'UTF-8')
    signingKey = base64.b64encode(hmac.new(secret_key, message, digestmod=hashlib.sha256).digest())
    return signingKey.decode('UTF-8')


def fields():
    baseurl = "https://elsa.apigw.ntruss.com" #{OpenAPI endpoint}
    url = "/api/v1/fields?projectKey=Pbxxxxx_elsa-test&projectId=8171&from=1381190400000&to=1381190400000"

    access_key = "accessKey" #{Main / Sub Account Access Key}
    secret_key = "secretKey" #{Main / Sub Account Secret Key}
    timestamp = int(time.time() * 1000)

    signature = make_signature(access_key, secret_key, timestamp, url)

    url = baseurl + url
    headers = {
        "x-ncp-apigw-timestamp": str(timestamp),
        "x-ncp-iam-access-key": access_key,
        "x-ncp-apigw-signature-v2": str(signature)
    }

    response = requests.get(url=url,
                  verify=True,
                  headers=headers
                  )

Response

Response body

{
"data":[
	"Platform.raw","projectKey","body.raw"
	],
"status":200
}