<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Handling Failures in Pipelines(處理管道中的故障) 原文鏈接 : [https://www.elastic.co/guide/en/elasticsearch/reference/5.3/handling-failure-in-pipelines.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/handling-failure-in-pipelines.html) 譯文鏈接 : [http://www.apache.wiki/pages/viewpage.action?pageId=9406217](http://www.apache.wiki/pages/viewpage.action?pageId=9406217) 貢獻者 : [那伊抹微笑](/display/~wangyangting),[ApacheCN](/display/~apachecn),[Apache中文網](/display/~apachechina) 在最簡單的 **use** **case**(使用案例)中,一個 **pipeline**(管道)定義了一個順序指定的 **processor**(處理器)的列表,并且會在第一個 **exception**(異常)發生時終止處理。當預期出現故障時,這種行為可能不是令人滿意的。例如,您可能有與指定的 **grok** **expression** 不匹配的 **log**(日志)。您可能希望將這些 (文檔)編入一個單獨的 **index**(索引),而不是停止執行。 為了啟用這種行為,您可以使用 **on_failure** 參數。該 **on_failture** 參數定義了要在故障的 **processor**(處理器)之后立即執行的 **processor** (處理器)列表。你可以在 **pipeline**(管道)級別,以及 **processor**(處理器)級別指定該參數。如果 **processor**(處理器)指定了 **on_failure** 配置,無論它是否為空,任何 **processor**(處理器)拋出的 **exception**(異常)都會被 **catch**(捕獲)。并且 **pipeline**(管道)繼續執行剩余的 **processors**(處理器)。因為您可以在 **on_failure?**語句范圍內定義進一步的 **processor**(處理器),您還可以 **nest**(嵌套)故障處理。 以下示例定義了一個在文檔處理時重命名 **foo?**為 **bar** 字段的?**pipeline**(管道)。如果 **document**(文檔)不包含 **foo** 字段,該 **processor** 將會附帶一個 **error**(錯誤)信息到文檔,以便以后在 **Elasticsearch** 中進行分析。 ``` { "description" : "my first pipeline with handled exceptions", "processors" : [ { "rename" : { "field" : "foo", "target_field" : "bar", "on_failure" : [ { "set" : { "field" : "error", "value" : "field \"foo\" does not exist, cannot rename to \"bar\"" } } ] } } ] } ``` 以下示例在整個 **pipeline**(管道)級別上定義了一個 **on_failure** 塊,它用于更改發送失敗的 **document**(文檔)的 **index**(索引)。 ``` { "description" : "my first pipeline with handled exceptions", "processors" : [ ... ], "on_failure" : [ { "set" : { "field" : "_index", "value" : "failed-{{ _index }}" } } ] } ``` 或者,在處理器故障的情況下,不是定義行為,還可以通過指定?**`ignore_failure?`**設置來忽略故障并繼續下一個 **processor**(處理器)。 在下面的例子中,如果字段?`**foo**?`不存在,故障將被捕獲并且 **pipeline**(管道)繼續執行,在這種情況下意味著 **pipeline**(管道)什么都不做。 ``` { "description" : "my first pipeline with handled exceptions", "processors" : [ { "rename" : { "field" : "foo", "target_field" : "bar", "ignore_failure" : true } } ] } ``` 該?**`ignore_failure`** 可以設置在任何 **processor**(處理器)上且默認值為 **false**。 ### Accessing Error Metadata From Processors Handling Exceptions(從處理器處理的異常中訪問錯誤的元數據) 您也許想要獲取 **processor**(處理器)所拋出的真實的 **error** **message**(錯誤信息)。要做到這一點,您可以訪問名為?**on_failure_message**,**on_failure_processor_type** 和?**on_failure_processor_tag** 的 **metadata** **fields**(元數據字段)。這些 **fileds**(字段)只能從?**on_failure** 塊的上下文中訪問。 這是您之前看到的示例的一個更新版本。但是,該示例不是手動設置?**error**?**message**(錯誤信息),而是使用?**`on_failure_message`**元數據字段來提供?**error**?**message**(錯誤信息)。 ``` { "description" : "my first pipeline with handled exceptions", "processors" : [ { "rename" : { "field" : "foo", "to" : "bar", "on_failure" : [ { "set" : { "field" : "error", "value" : "{{ _ingest.on_failure_message }}" } } ] } } ] } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看