Logstash API
editLogstash API
edit以下API用于管理由Logstash 集中管理使用的管道:
创建或更新 Logstash 管道 API
edit此API用于创建或更新用于Logstash集中管理的Logstash管道。
请求
editPUT _logstash/pipeline/
先决条件
edit-
如果启用了Elasticsearch安全功能,您必须拥有
manage_logstash_pipelines集群权限才能使用此API。
描述
edit创建一个Logstash管道。如果指定的管道存在,则替换该管道。
路径参数
edit-
<pipeline_id> - (必需,字符串)管道的标识符。
请求体
edit-
description - (可选, 字符串) 管道的描述。此描述不会被Elasticsearch或Logstash使用。
-
last_modified -
(必需,字符串)
管道最后一次更新的日期。必须采用
yyyy-MM-dd'T'HH:mm:ss.SSSZZstrict_date_time格式。 -
pipeline - (必需,字符串) 管道的配置。有关支持的语法,请参阅 Logstash 配置文档。
-
pipeline_metadata - (必需, 对象) 关于管道的可选元数据。可以包含任何内容。此元数据不会由 Elasticsearch 或 Logstash 生成或使用。
-
pipeline_settings - (Required, object) Settings for the pipeline. Supports only flat keys in dot notation. For supported settings, see the Logstash settings documentation.
-
username - (必需,字符串) 最后更新管道的用户。
示例
edit以下示例创建一个名为 my_pipeline 的新管道:
PUT _logstash/pipeline/my_pipeline
{
"description": "Sample pipeline for illustration purposes",
"last_modified": "2021-01-02T02:50:51.250Z",
"pipeline_metadata": {
"type": "logstash_pipeline",
"version": "1"
},
"username": "elastic",
"pipeline": "input {}\n filter { grok {} }\n output {}",
"pipeline_settings": {
"pipeline.workers": 1,
"pipeline.batch.size": 125,
"pipeline.batch.delay": 50,
"queue.type": "memory",
"queue.max_bytes": "1gb",
"queue.checkpoint.writes": 1024
}
}
如果请求成功,您将收到一个带有适当状态码的空响应。
删除 Logstash 管道 API
edit此 API 删除用于 Logstash 集中管理的管道。
请求
editDELETE _logstash/pipeline/
先决条件
edit-
如果启用了Elasticsearch安全功能,您必须拥有
manage_logstash_pipelines集群权限才能使用此API。
描述
edit删除一个 Logstash 管道。
路径参数
edit-
<pipeline_id> - (必需,字符串) 管道的标识符。
获取管道 API
edit此API用于检索用于 Logstash集中管理的管道。
先决条件
edit-
If the Elasticsearch security features are enabled, you must have the
manage_logstash_pipelinescluster privilege to use this API.
描述
edit检索一个或多个 Logstash 管道。
路径参数
edit-
<pipeline_id> - (可选,字符串) 以逗号分隔的管道标识符列表。
示例
edit以下示例检索名为 my_pipeline 的管道:
GET _logstash/pipeline/my_pipeline
如果请求成功,响应的主体包含管道定义:
{
"my_pipeline": {
"description": "Sample pipeline for illustration purposes",
"last_modified": "2021-01-02T02:50:51.250Z",
"pipeline_metadata": {
"type": "logstash_pipeline",
"version": "1"
},
"username": "elastic",
"pipeline": "input {}\n filter { grok {} }\n output {}",
"pipeline_settings": {
"pipeline.workers": 1,
"pipeline.batch.size": 125,
"pipeline.batch.delay": 50,
"queue.type": "memory",
"queue.max_bytes": "1gb",
"queue.checkpoint.writes": 1024
}
}
}