Skip to content

NimTechnology

Trình bày các công nghệ CLOUD một cách dễ hiểu.

  • Kubernetes & Container
    • Docker
    • Kubernetes
      • Gateway API
      • Ingress
      • Pod
    • Helm Chart
    • OAuth2 Proxy
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Argo Events
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • DevSecOps
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
      • Azure Cloud
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log, Monitor & Tracing
    • DataDog
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
    • NextCloud
  • Toggle search form

[Coralogix] DataPrime Query on Coralogix

Posted on October 17, 2025March 13, 2026 By nim No Comments on [Coralogix] DataPrime Query on Coralogix

Mình ví dụ bạn có log như sau dưới dạng Json

{
  "logRecord": {
    "attributes": {
      "cluster_name": "prod-region-cluster-name",
      "log.file.path": "/var/log/pods/namespace_pod-name_pod-uid/container-name/0.log",
      "log.iostream": "stdout",
      "logtag": "F",
      "time": "2025-10-17T06:59:59.829749004Z"
    },
    "body": {
      "current_level": 2,
      "current_number": 342,
      "dataId": "example_data_id_12345::fb5827455d",
      "engines": [
        "comodo",
        "zillya",
        "aegislab",
        "clamav",
        "cmc",
        "k7",
        "nano",
        "cyren",
        "mcafee",
        "viritml",
        "xviruspersonalguard",
        "webroot",
        "emsisoft",
        "ahnlab",
        "quickheal",
        "tachyon",
        "filseclab",
        "bkav",
        "viritexplorer",
        "avira",
        "rocketcyber",
        "ikarus",
        "bitdefender",
        "archive"
      ],
      "esIndexName": "results",
      "fileInfo": {
        "child_file_start_timestamp": "2025-10-17T06:59:59.242Z",
        "display_name": "example-file.js",
        "file_extensions": "JS",
        "file_size": 4012,
        "file_type": "application/javascript",
        "file_type_description": "JavaScript Source",
        "md5": "REDACTED_MD5_HASH",
        "sha1": "REDACTED_SHA1_HASH",
        "sha256": "REDACTED_SHA256_HASH",
        "type_category": ["T"]
      },
      "filetypeInfo": {
        "file_info": {
          "description": "JavaScript Source",
          "detected_by": "ML Detection Model",
          "encrypted": false,
          "extensions": "js",
          "groupID": "T",
          "groupIDs": ["T"],
          "group_description": "Text Files",
          "likely_type_ids": [
            {
              "score": 1,
              "typeID": "JS"
            },
            {
              "score": 0.8,
              "typeID": "TXT"
            }
          ],
          "type": "application/javascript",
          "typeID": "JS",
          "type_ids": ["JS"]
        },
        "final_verdict": {
          "verdict": "allowed",
          "verdict_explanation": []
        },
        "other_detections": [
          {
            "description": "JS",
            "detector": "Magika",
            "score": 1
          },
          {
            "description": "",
            "detector": "TrID",
            "score": 1
          },
          {
            "description": "ASCII text",
            "detector": "libmagic",
            "score": 1
          }
        ],
        "result_template_hash": "example_template_hash_abc123",
        "spoofing_info": {
          "detection_result": "Not Configured",
          "result_explanation": "",
          "result_overview": "Spoofing Detection Was Not Configured"
        },
        "version": 2
      },
      "parentId": "example_parent_id_67890::ab468caeec",
      "priority": "ARCHIVE",
      "processInfo": {
        "blocked_reasons": [],
        "failure_reasons": [],
        "post_processing": {
          "actions_failed": "",
          "actions_ran": "",
          "converted_destination": "",
          "converted_to": "",
          "copy_move_destination": "",
          "sanitization_details": {
            "description": "",
            "details": "",
            "failure_category": "",
            "sanitized_file_info": {
              "data_id": "",
              "file_path": "/path/to/file",
              "file_size": 0,
              "md5": "",
              "sha1": "",
              "sha256": ""
            }
          }
        },
        "processing_time": 23769,
        "processing_time_details": {
          "aggregated_time": 472,
          "archive_time": 0,
          "av_scan_time": 216,
          "cdr_time": 0,
          "coo_time": 0,
          "dlp_time": 0,
          "download_time": 51,
          "filescanio_time": 0,
          "filetype_time": 266,
          "oesis_time": 0,
          "others_time": 0,
          "sbom_time": 0,
          "total_inqueue_time": 23769
        },
        "progress_percentage": 100,
        "result": "Allowed",
        "verdicts": ["No Threat Detected"]
      },
      "requestId": "example_request_id_abc123",
      "scanResults": {
        "current_av_result_a": "No Threat Detected",
        "current_av_result_i": 0,
        "data_id": "example_data_id_12345::fb5827455d",
        "first_response_received_by_apiv4handler_timestamp": "2025-10-17T06:59:34.501Z",
        "first_response_received_by_resulthandler_timestamp": "2025-10-17T06:59:34.513Z",
        "last_response_aggregated_by_apiv4handler_timestamp": "2025-10-17T06:59:59.803Z",
        "last_response_received_by_resulthandler_timestamp": "2025-10-17T06:59:59.802Z",
        "request_processed_by_request_handler_timestamp": "2025-10-17T06:59:34.515Z",
        "request_received_from_scantopic_timestamp": "2025-10-17T06:59:34.361Z",
        "scan_all_result_a": "No Threat Detected",
        "scan_all_result_i": 0,
        "scan_details": {
          "aegislab": {
            "db_package_version": "1760679323",
            "def_time": "2025-10-17T06:25:07.767Z",
            "eng_id": "aegislab",
            "eng_package_version": "8.23-1713",
            "inqueue_time": 9,
            "scan_result_i": 0,
            "scan_time": 3,
            "threat_found": ""
          },
          "ahnlab": {
            "db_package_version": "2025.10.17.02",
            "def_time": "2025-10-17T06:37:24.340Z",
            "eng_id": "ahnlab",
            "eng_package_version": "3.27.2.4-2358",
            "inqueue_time": 10,
            "scan_result_i": 0,
            "scan_time": 8,
            "threat_found": ""
          },
          "clamav": {
            "db_package_version": "1760572800",
            "def_time": "2025-10-17T06:28:29.798Z",
            "eng_id": "clamav",
            "eng_package_version": "1.4.3-2545",
            "inqueue_time": 9,
            "scan_result_i": 0,
            "scan_time": 12,
            "threat_found": ""
          }
        },
        "start_time": "2025-10-17T06:59:59.244Z",
        "total_avs": 23,
        "total_time": 216
      },
      "stat": {
        "aggregated_time": 501,
        "download_time": 51,
        "engine_7z_processed_request_timestamp": "2025-10-17T06:59:59.213Z",
        "engine_7z_received_request_timestamp": "2025-10-17T06:59:35.607Z",
        "engine_7z_request_inqueue_time": 23643,
        "engine_7z_result_inqueue_time": null,
        "engine_7z_scan_time": 23606,
        "engine_aegislab_processed_request_timestamp": "2025-10-17T06:59:59.301Z",
        "engine_aegislab_received_request_timestamp": "2025-10-17T06:59:59.259Z",
        "engine_aegislab_request_inqueue_time": 9,
        "engine_aegislab_result_inqueue_time": 49,
        "engine_aegislab_result_received_timestamp": "2025-10-17T06:59:59.350Z",
        "engine_aegislab_scan_time": 42,
        "first_result_received_timestamp": "2025-10-17T06:59:59.315Z",
        "request_inqueue_time": 23643,
        "request_processed_timestamp": "2025-10-17T06:59:59.250Z",
        "request_processing_time": 6,
        "request_received_timestamp": "2025-10-17T06:59:59.244Z",
        "result_aggregate_completed_timestamp": "2025-10-17T06:59:59.816Z",
        "result_inqueue_time": 126,
        "total_engine_scan_time": 23606,
        "total_inqueue_time": 23769,
        "total_scan_time": 572
      },
      "totalTimeOutAvs": 0
    },
    "observedTimeUnixNano": 1760684399858131700,
    "timeUnixNano": 1760684399829749000,
    "timestamp": "2025-10-17 06:59:59"
  },
  "resource": {
    "attributes": {
      "k8s.container.name": "archive-result-handler",
      "k8s.container.restart_count": "0",
      "k8s.deployment.name": "archive-result-handler",
      "k8s.namespace.name": "application-namespace",
      "k8s.node.name": "ip-10-0-0-100.region.compute.internal",
      "k8s.pod.name": "archive-result-handler-bc8f9b75-r5zvt",
      "k8s.pod.uid": "c6f279a8-2eca-4554-98ba-fa3d6f096288"
    }
  },
  "scope": {
    "attributes": {}
  }
}

Bạn muốn lấy total Scan time để vẽ chart.

Đây lấy được Patent Query đâu tiên bạn có thể hỏi AI có sẵn trong Coralogix trước nhé.

Nó sẽ gợi ý như sau

Bạn có thể kiểm tra nó có match với log của bạn không?

Giờ chúng ta thử vẽ:

source logs
| filter $d.logRecord.attributes.cluster_name ~ 'prod-uswest2-mdcl-nim'
| filter $d.logRecord.body.stat.request_inqueue_time != null
| create time_bucket from roundTime($m.timestamp, 5.toInterval('m'))
| groupby time_bucket aggregate avg($d.logRecord.body.stat.request_inqueue_time) as request_inqueue_time



source logs
| filter $d.logRecord.attributes.cluster_name ~ 'prod-uswest2-mdcl-nim'
| filter $d.logRecord.body.stat.result_inqueue_time != null
| create time_bucket from roundTime($m.timestamp, 5.toInterval('m'))
| groupby time_bucket aggregate avg($d.logRecord.body.stat.result_inqueue_time) as result_inqueue_time

source logs
| filter $d.logRecord.attributes.cluster_name ~ 'prod-uswest2-mdcl-nim'
| filter $d.logRecord.body.stat.total_scan_time != null
| create time_bucket from roundTime($m.timestamp, 5.toInterval('m'))
| groupby time_bucket aggregate avg($d.logRecord.body.stat.total_scan_time) as total_scan_time


source logs
| filter $d.logRecord.body.scanResults.scan_details.ahnlab.inqueue_time != null
| create time_bucket from roundTime($m.timestamp, 5.toInterval('m'))
| groupby time_bucket aggregate avg($d.logRecord.body.scanResults.scan_details.ahnlab.inqueue_time) as avg_inqueue_time
| choose time_bucket, avg_inqueue_time

Contents

Toggle
  • Call the API to get the log by Dataprime
    • Method 1: Using the JSON Metadata
    • Method 2: Filtering Relative Time in the Query
    • Method 3: Using the “between” Keyword in the Query

Call the API to get the log by Dataprime

Method 1: Using the JSON Metadata

Cách rõ ràng nhất để chỉ định thời gian bắt đầu và kết thúc tuyệt đối thông qua API là thêm các trường startDate và endDate vào bên trong đối tượng JSON metadata. Các dấu thời gian phải được định dạng theo chuẩn ISO 8601 (ví dụ: UTC với chữ Z ở cuối).

curl -X POST "https://api.coralogix.us/api/v1/dataprime/query" \
-H "Authorization: Bearer cccccjkXzqJ6kVFccccc6CBcccccd1C6z3" \
-H "Content-Type: application/json" \
-d '{
  "query": "source logs | filter $l.applicationname == '\''nim-engines-integration'\''",
  "metadata": {
    "tier": "TIER_ARCHIVE",
    "startDate": "2026-03-12T00:00:00Z",
    "endDate": "2026-03-13T00:00:00Z"
  }
}'

TIER_ARCHIVE: nghĩa là all log (Gồm cả log bạn lưu trữ trên S3 để tiết kiệm tiền)
TIER_FREQUENT_SEARCH: Đây là store mặc định của Coralogix

Method 2: Filtering Relative Time in the Query

Nếu bạn muốn liên tục kéo nhật ký cho một khung thời gian trượt (ví dụ: 2 giờ cuối cùng hoặc 15 phút cuối cùng), bạn có thể sử dụng hàm now() và trường siêu dữ liệu $m.timestamp trực tiếp trong chuỗi truy vấn DataPrime của bạn.

curl -X POST "https://api.coralogix.us/api/v1/dataprime/query" \
-H "Authorization: Bearer cccccjkXzqJ6kVFccccc6CBcccccd1C6z3" \
-H "Content-Type: application/json" \
-d '{
  "query": "source logs | filter now() - $m.timestamp < 2h | filter $l.applicationname == '\''mdaas-engines-integration'\''",
  "metadata": {
    "tier": "TIER_ARCHIVE"
  }
}'

Method 3: Using the “between” Keyword in the Query

Bạn cũng có thể đặt ranh giới thời gian tuyệt đối bằng cách thêm từ khóa between ngay sau nhật ký nguồn trong truy vấn DataPrime của bạn. Lưu ý rằng các ký tự thời gian trong DataPrime yêu cầu ký hiệu @ theo sau là dấu nháy đơn, cần được thoát trong tập lệnh Bash của bạn dưới dạng '\''

curl -X POST "https://api.coralogix.us/api/v1/dataprime/query" \
-H "Authorization: Bearer cccccjkXzqJ6kVFccccc6CBcccccd1C6z3" \
-H "Content-Type: application/json" \
-d '{
  "query": "source logs between @'\''2026-03-12T00:00:00Z'\'' and @'\''2026-03-13T00:00:00Z'\'' | filter $l.applicationname == '\''mdaas-engines-integration'\''",
  "metadata": {
    "tier": "TIER_ARCHIVE"
  }
}'
Log, Monitor & Tracing

Post navigation

Previous Post: [Teams] Microsoft Teams notification
Next Post: [Istio] Custom Authorization with Istio

More Related Articles

[Monitoring] Understanding Different Types of Metrics in Monitoring Systems: Gauge, Counter, Histogram, and Summary Log, Monitor & Tracing
[OpenTelemetry/Jaeger] Install Opentelemetry and Jaeger to receive and analyze the tracing data Log, Monitor & Tracing
[coralogix/OpenTelemetry] Monitor Your K8s by Coralogix and OpenTelemetry Collector. Log, Monitor & Tracing
[Monitoring] Understand percentiles in monitoring. Grafana
[OpenVPN] How do you monitor Your OpenVPN-Server via Prometheus and Grafana Grafana
[Kafka] Kafka Console Producer CLI. Apache Kafka

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tham Gia Group DevOps nhé!
Để Nim có nhiều động lực ra nhiều bài viết.
Để nhận được những thông báo mới nhất.

Recent Posts

  • [Rancher/EKS] Rancher from v2.12.x can not work on eks cluster. April 15, 2026
  • [Telegram/Openclaw] Configure openclaw bot in a Telegram group. March 31, 2026
  • Tutorial: Gateway API + Traefik + oauth2-proxy (Microsoft Entra ID) March 30, 2026
  • Full + incremental backup: When restoring, do deleted files come back? March 27, 2026
  • [K8S] Create long-lived kubeconfig on k8s March 23, 2026

Archives

  • April 2026
  • March 2026
  • February 2026
  • January 2026
  • December 2025
  • November 2025
  • October 2025
  • September 2025
  • August 2025
  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • AI
    • OpenClaw
  • BareMetal
    • NextCloud
  • CI/CD
    • Argo Events
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • DevSecOps
    • Golang
    • Jquery & JavaScript
    • Laravel
    • NextJS 14 & ReactJS & Type Script
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • Azure Cloud
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Gateway API
      • Ingress
      • Pod
    • Longhorn – Storage
    • MetalLB
    • OAuth2 Proxy
    • Vault
    • VictoriaMetrics
  • Log, Monitor & Tracing
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Fluent
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2026 NimTechnology.