download
    • PDF

    download

    • PDF

    Article summary

    Overview

    You can download Effective Log Search & Analytics logs by project.

    Request

    API URL

    POST
    https://elsa.apigw.ntruss.com/api/v1/logs/download
    

    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 nameRequirement statusTypeRestrictionsDescription
    projectKeyYesstring1-53Project key

    Example:
    "projectKey":"Pxxxxxx_test"
    projectIdYesintProject Id

    Example:
    “projectId”:8181
    fromYesintThe timestamp at which to start the search (UTC milliseconds).

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

    Example:
    “to”:1381190400000
    formatNostringCSV or JSONDefault: JSON
    File format to download.

    Example:
    “format”: “CSV”
    limitNoint1 - 1000Default: 100
    This is the number of logs to return upon request.

    Example:"limit": 1000
    countNoint1 - 200000Default: 100000
    The total number of log downloads.

    Example:
    “count”: 200000
    includeFieldsNo[string]Default value: all fields
    This is the list of field names needed to download logs.

    Example:
    “includeFields”: [“logSource”,” logType”,”body”]

    Request body

    {
      "projectKey": "Pbxxxxx_elsa-test",
      "projectId": 16706,
      "from": 1381190400000,
      "to": 1381190400000,
      "format": "JSON",
      "includeFields": ["logSource","logType","ExceptionType"],
      "limit": 100,
      "count": 50000
    }
    

    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 = "POST"
    
        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 log_download():
        baseurl = "https://elsa.apigw.ntruss.com" #{OpenAPI endpoint}
        url = "/api/v1​/logs​/download"
    
        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
    
        payload = 	{
    	  "projectKey": "Pbxxxxx_elsa-test",
    	  "projectId": 8171,
    	  "format": "JSON",
    	  "from": 1381190400000,
    	  "to": 1381190400000,
    	  "includeFields": ["logSource","logType","ExceptionType"],
    	  "limit": 100,
    	  "count": 50000
    	}
    
    
        headers = {
            "x-ncp-apigw-timestamp": str(timestamp),
            "x-ncp-iam-access-key": access_key,
            "x-ncp-apigw-signature-v2": str(signature)
        }
    
        response = requests.post(url=url,
                      json=payload,
                      verify=True,
                      headers=headers
                      )
    

    Response

    Response body

    application/zip
    

    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.