如果你需要在同一個進程中運行不止一個管道,Logstash提供了一種方法,通過一個叫做`pipelines.yml`的配置文件.這個文件必須放在`path.settings`指定的目錄(通過命令行可以指定此目錄的位置,默認配置參考之前的Logstash目錄布局.)并且文件內容遵循以下結構.
```yaml
- pipeline.id: my-pipeline_1
path.config: "/etc/path/to/p1.config"
pipeline.workers: 3
- pipeline.id: my-other-pipeline
path.config: "/etc/different/path/p2.cfg"
queue.type: persisted
```
這個文件使用了YAML格式,包含一個字典列表,每個字典描述一個管道,每個鍵值對定義一個所在管道的設置項.示例顯示了由他們的ID描述的兩個不同的管道和配置路徑. 對于第一個管道,`pipeline.workers`設置為3,而另外一個,則啟用了隊列功能.在`pipelines.yml`文件中沒有明確定義的設置,將會使用`logstash.yml`[設置文件](https://www.elastic.co/guide/en/logstash/current/logstash-settings-file.html)指定的默認設定.
如果你在啟動Logstash的時候沒有加參數,它將會讀取`logstash.yml`并實例化其中定義的所有管道.另一方面,如果你使用`-e`或`-f`,Logstash將會忽略`pipeline.yml`文件并輸出一個相關警告日志.
#### 使用的注意事項
如果當前配置的事件流不共享相同的inputs/filters和outputs,并且使用標簽和條件將它們彼此分開,則使用多個管道尤其有用。
在單個實例中有多個管道還允許這些事件流具有不同的性能和持久性參數(比如,不同數量的pipeline workers和持久化隊列).這種分離意味著,一個管道output阻塞不會在另一個管道產生壓力.
這就是說,考慮到管道之間的資源分配是很重要的,要對單個管道的默認值進行調優.比如,可以考慮降低每個管道中worker的數量.因為默認情況下每個管道中的每個worker都需要占用一個CPU內核.
原文:That said, it’s important to take into account resource competition between the pipelines, given that the default values are tuned for a single pipeline. So, for example, consider reducing the number of pipeline workers used by each pipeline, because each pipeline will use 1 worker per CPU core by default.
持久化隊列和死信隊列是單獨隔離的管道.有自己本地的通過`pipeline.id`定義的名稱空間.原文:Persistent queues and dead letter queues are isolated per pipeline, with their locations namespaced by the `pipeline.id` value.
- Emmm
- Logstash簡介
- 開始使用Logstash
- 安裝Logstash
- 儲存你的第一個事件
- 通過Logstash解析日志
- 多個輸入和輸出插件的混合使用
- Logstash是如何工作的
- 執行模型Execution Model
- 設置并運行Logstash
- Logstash目錄布局
- Logstash配置文件
- logstash.yml
- Secrets keystore for secure settings
- 從命令行運行Logstash
- 以服務的方式運行Logstash
- 在Docker中運行Logstash
- 配置容器版Logstash
- Logging
- 關閉Logstash
- 安裝X-Pack
- 設置X-Pack
- 升級Logstash
- 使用包管理升級
- 直接下載進行升級
- 升級至6.0
- Upgrading with the Persistent Queue Enabled
- 配置Logstash
- 管道配置文件的結構
- 訪問配置中的事件數據和字段
- 在配置中使用環境變量
- Logstash配置示例
- 多管道
- 管道間通信(beta)
- 重載配置文件
- 管理多行事件
- Glob Pattern Support
- Converting Ingest Node Pipelines
- Logstash間通信
- 配置集中式管道管理
- X-Pack Monitoring
- X-Pack Security
- X-Pack Settings
- Field References Deep Dive(深入字段引用)
- 管理Logstash
- 集中式管道管理
- 使用Logstash模塊
- 使用Elastic Cloud
- Logstash ArcSight模塊