Code Monkey home page Code Monkey logo

Comments (5)

okkez avatar okkez commented on May 28, 2024

If dispatch the message when timeout occurred, we may get broken incomplete message.
It is very hard to process them properly, I think.

You can use timeout_label to handle timeout events same as normal events.

<filter docker.*>
  @type concat
  ...
  timeout_label @TIMEOUT
</filter>

<label @TIMEOUT>
  <match docker.*>
    @type stdout
  </match>
</label>

<match docker.*>
  @type stdout
</match>

I cannot detect that next chain is filter plugin or output plugin in timeout context.

from fluent-plugin-concat.

LiberQuack avatar LiberQuack commented on May 28, 2024

Hmmmm... true I'll try to use that

After concat I have this config

<match **>
    type copy
    <store>
        type elasticsearch
        host elasticsearch
        port 9200
        logstash_format true
    </store>
    <store>
        type grepcounter
        count_interval 30
        input_key log
        regexp ERROR
        threshold 1
        delimiter \n\n
        add_tag_prefix notification.error
    </store>
</match>

I tried to use multiline_end_regexp but most the times the end of a multline log is the begging of a new one... for exemple: setting "flush_interval 5" and "disable_timeout true" the user would have the assumption no other log came, so keep on (even knowing the risk of broken log)... This option should also disable the warning in fluentd log

I'm not sure (to be honest it's my first time using fluentd)... but using timeout_label the config above should be copied in a ? I mean... or is there anyway to reference instead of Ctrl C then V?

from fluent-plugin-concat.

okkez avatar okkez commented on May 28, 2024

You can omit multiline_end_regexp if you don't know that the end line of logs.
You must specify multiline_start_regexp only.

For example,

<fileter docker.*>
  @type concat
  key message
  multi_line_start_regxp /^Start/
  flush_interval 6000 # very very long flush interval
</filter>

This works as followings:

  1. Start starts multiline logs
  2. Concatenate any lines to buffer until next Start
  3. Get next Start, flush buffer before this Start
  4. Start new buffer and concatenate any lines to buffer until next Start

📝 If you cannot get next Start, this plugin cannot flush buffer forever (until flush_interval).

I'm not sure (to be honest it's my first time using fluentd)... but using timeout_label the config above should be copied in a ? I mean... or is there anyway to reference instead of Ctrl C then V?

Yes. You need to copy and paste, if you want same behavior for normal and timeout.
I know this is annoying to maintain fluentd configuration.

from fluent-plugin-concat.

LiberQuack avatar LiberQuack commented on May 28, 2024

Sure... I got the idea :D

Gonna close this issue

from fluent-plugin-concat.

mdamir avatar mdamir commented on May 28, 2024

@okkez The copy paste can be avoided by using the relabel plugin, as follows:

<filter **>
@type concat
key "message"
multiline_start_regexp "/^Start/"
flush_interval 5
timeout_label "@LASTLINE"
</filter>
<match **>
@type relabel
@label @NORMAL
</match>
<label @LASTLINE>
<match **>
@type relabel
@label @NORMAL
</match>
</label>
<label @NORMAL>
<match **>
@type stdout
</match>
</label>

from fluent-plugin-concat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.