您的位置 首页 elasticsearch

es DSL实战2 (日志查询)

【DSL】ES+DSL 查询语法_es dsl-CSDN博客

 

es DSL 语句查询 实战1 : 连接

es DSL实战2 (日志查询): 连接

es DSL 查询特殊字符 (转义字符) :连接

日志格式

      {
        "_index" : "ks-logstash-log-2024.02.05",
        "_type" : "_doc",
        "_id" : "9dc830a1-6da2-bb33-cf4e-d2e9548750eb",
        "_score" : 1.0,
        "_source" : {
          "@timestamp" : "2024-02-05T00:01:14.188Z",
          "log" : """	at java.naming/com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3259)
""",
          "time" : "2024-02-05T00:01:14.18895834Z",
          "kubernetes" : {
            "pod_name" : "devops-jenkins-6f665b6758-g8rbz",
            "namespace_name" : "kubesphere-devops-system",
            "container_name" : "devops-jenkins",
            "docker_id" : "67da52f01971a48e90739dbe7fb83721a10c063b3b5d265b98cbf22feceeec63",
            "container_image" : "registry.cn-beijing.aliyuncs.com/kubesphereio/ks-jenkins:v3.3.0-2.319.1"
          }
        }
      }

语法:

GET ks-logstash-log-2024.02.05/_search

 

 

1- 根据字段  过滤

GET ks-logstash-log-2024.02.04/_search
{
  "query": {
    "bool": {
      "must": [
        { "match": { "log": " [ERROR] " } }
      ]
    }
  }
}

 

欢迎来撩 : 汇总all

白眉大叔

关于白眉大叔linux云计算: 白眉大叔

热门文章