<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>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] # Managing Mutiline Events(管理多行事件) 某些用例產生跨多行文本的事件。為了正確處理這些事件,Logstash需要知道哪些行是單個事件的一部分。 處理多行事件是復雜的并且依賴于適當的事件排序。確保有序的日志處理的最佳方法是在管道中盡可能早的處理。 [Multiline](https://www.elastic.co/guide/en/logstash/6.5/plugins-codecs-multiline.html) 編碼器是Logstash管道中處理多行事件的首選工具。Multiline編解碼器使用一組簡單的規則將單個輸入中的行合并。 > <font color=#DC143C size=4>IMPORTANT</font>:如果你使用的是支持多個主機的Logstash input插件,如beats,你應該使用諸如[Multiline](https://www.elastic.co/guide/en/logstash/6.5/plugins-codecs-multiline.html) 編解碼器來處理多行事件。Doing so may result in the mixing of streams and corrupted event data.(這樣做可能會導致流混合和損壞的事件數據。)這種情況,你需要在事件數據被發送到Logstash之前處理多行事件。 配置多行編解碼器最重要的是下面這些: + `Pattern`選項指定一個正則表達式。被匹配的行被解析為前一行的連續或者新的多行時間的開始。你可以在此配置選項中使用grok正則表達式模板。 + `What`選項的值有兩個:`previous`或`next`。`Previous`表示在`pattern`選項中匹配到的值是前一行的一部分。`Next`表示在`pattern`選項中匹配到的值是接下來的行的一部分。`Negate`選項將沒有被`pattern`選項中匹配到的行應用到多行編解碼器。(The `negate` option applies the multiline codec to lines that *do not* match the regular expression specified in the `pattern` option.) 關于[multiline](https://www.elastic.co/guide/en/logstash/6.5/plugins-codecs-multiline.html)編解碼器插件的更多信息和配置選項,參考完整文檔。 # Multiline編解碼器配置示例 本章節的示例包括以下用例: + 將Java堆棧跟蹤組合為單個事件 + 將C風格的行持續組合到單個事件中(Combining C-style line continuations into a single event) + 將來自時間戳的多行事件進行組合 ## Java堆棧跟蹤 Java 堆棧跟蹤由多行組成,在初始行開始后的每一行都以空白開始,如: ```log Exception in thread "main" java.lang.NullPointerException at com.example.myproject.Book.getTitle(Book.java:16) at com.example.myproject.Author.getBookTitles(Author.java:25) at com.example.myproject.Bootstrap.main(Bootstrap.java:14) ``` 要在Logstash中將這些行整合為一個事件,使用下面的multiline編解碼器配置: ```conf input { stdin { codec => multiline { pattern => "^\s" what => "previous" } } } ``` 這個配置將任何以空白開始的行合并到前一行。 ## Line Continuations(行延續?) 一些編程語言使用`\`字符在行的結尾表示行沒有結束,如: ```c printf ("%10.10ld \t %10.10ld \t %s\ %f", w, x, y, z ); ``` 要在Logstash中將這些行整合為一個事件,使用下面的multiline編解碼器配置: ```conf input { stdin { codec => multiline { pattern => "\\$" what => "next" } } } ``` 這個配置將任何以`\`字符結束的行合并到接下來的行。 ## 時間戳 來自諸如Elasticsearch等服務的活動日志通常以時間戳開頭,其次是具體的信息,如: ```log [2015-08-24 11:49:14,389][INFO ][env ] [Letha] using [1] data paths, mounts [[/ (/dev/disk1)]], net usable_space [34.5gb], net total_space [118.9gb], types [hfs] ``` 要在Logstash中將這些行整合為一個事件,使用下面的multiline編解碼器配置: ```conf input { file { path => "/var/log/someapp.log" codec => multiline { pattern => "^%{TIMESTAMP_ISO8601} " negate => true what => previous } } } ``` 這個配置使用`negate`選項來指定任何沒有以時間戳開頭的行屬于前一行。
                  <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>

                              哎呀哎呀视频在线观看