[[ Примеры API ]]

ELK

Примеры API

# Получить список индексов
GET _cat/indices/*
# Удалить индексы
DELETE filebeat-*
#
GET _template/*
GET _ingest/pipeline/*
GET _cluster/health
 
# The above request will return a response body containing a key-value representation of the built-in patterns dictionary.
# Список встроенных RegExp'ов в Grok Processor
GET _ingest/processor/grok

# Вставить данные через pipeline
POST filebeat-6.5.4-2019.01.18/doc?pipeline=filebeat-6.5.4-nginx-error-pipeline
{
  "message": """message"""
}

GET _cat/shards
GET _cat/shards?h=index,shard,prirep,state,unassigned.reason

# https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html
# Симуляция с существующим pipeline'ом
POST _ingest/pipeline/filebeat-6.5.4-nginx-error-pipeline/_simulate
{
  "docs": [
    {
      "_index": "index",
      "_type": "_doc",
      "_id": "id",
      "_source": {
        "@timestamp": "2019-01-18T04:07:53.913Z",
        "message": """2019/01/18 07:07:16 [error] 4088#0: *109084579 connect() failed (113: No route to host) while connecting to upstream, client: 107.46.13.155, server: , request: "GET / HTTP/1.1", upstream: "http://10.0.0.40:80/", host: "domain.ru" """
      }
    }
  ]
}

GET filebeat-nginx-6.5.4-2019.01.18/_search
{
  "query": {
    "exists": { "field": "error.message" }
  }
}
POST filebeat-nginx-6.5.4-2019.01.18/_delete_by_query
{
  "query": {
    "exists": { "field": "error.message" }
  }
}






Обсуждение

Ваш комментарий. Вики-синтаксис разрешён:
22 -15 =​
 
practice/elk/elasticsearch_api_examples.txt · Последнее изменение: 2022/08/31 14:53 — 127.0.0.1
Gentoo Linux Gentoo Linux Driven by DokuWiki