Code Monkey home page Code Monkey logo

Comments (20)

naerymdan avatar naerymdan commented on May 27, 2024 2

Is there really no way to simply close a multiline capture when timeout is reached and process like normal? A lot of situations (java logs & stacktrace) have no clear multiline end.

The other plugins from fluentd, like the memory buffer ones seems to be able to simply apply a flush interval to their processing, at which point all the collected stuff simply goes on to be processed normally.

from fluent-plugin-concat.

mdamir avatar mdamir commented on May 27, 2024 1

A workaround this would be to use the relabel plugin to label in both cases i.e. in case when concat gives timeout and in case when it does not and then, finally putting all your output plugins under that label. Here is an example:

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

This will solve the duplicacy issue.

from fluent-plugin-concat.

okkez avatar okkez commented on May 27, 2024

I will consider this issue in next week.
(I will add new option or ...)

from fluent-plugin-concat.

macdjord avatar macdjord commented on May 27, 2024

This does not solve my use case. I do not want to wait forever for the next line. In some cases, it could be hours or days before the next line occurs. If 60s go by with no new lines, that's probably it - I want to output what is in the buffer without generating an error.

from fluent-plugin-concat.

okkez avatar okkez commented on May 27, 2024

Use timeout_label configuration.

from fluent-plugin-concat.

macdjord avatar macdjord commented on May 27, 2024

That's what I do currently, but it adds a lot of pointless complexity to my config files and generates spurious timeout warning messages. All I want is to output my timeouts the same way other lines are output.

from fluent-plugin-concat.

LiberQuack avatar LiberQuack commented on May 27, 2024

+1

Some time ago I requested the same in #7

from fluent-plugin-concat.

okkez avatar okkez commented on May 27, 2024

Hmm...

  • Use timeout_label
    • 👍 Reduce warnings
    • 👎 Complex duplicated configuration
  • Not using timeout_label
    • 👎 warnings
    • 👎 Complex duplicated configuration

You want:

  • No warnings when timeout occurs
  • Need timeout and flush buffer and emit normal event
  • No complex duplicated configuration

Right?

from fluent-plugin-concat.

macdjord avatar macdjord commented on May 27, 2024

Yes. When the timeout happens, just emit whatever's in the buffer, as if a startline had come in.

from fluent-plugin-concat.

okkez avatar okkez commented on May 27, 2024

It is impossible to implement such a thing.
It is the limitation of Fluentd.

from fluent-plugin-concat.

macdjord avatar macdjord commented on May 27, 2024

Er? You already emit the buffer content, directed to timeout_label. Is it really not possible to simply do the same, but direct it to the default label instead?

And it's definitely possible to not emit an error message - just make line 188 conditional.

from fluent-plugin-concat.

okkez avatar okkez commented on May 27, 2024

It is impossible.
If just call router.emit, it skips remained filters defined after filter_concat.

You can set log_level per plugin.

<filter>
  @type concat
  log_level warn
  # ... snip
</filter>

from fluent-plugin-concat.

freemanh avatar freemanh commented on May 27, 2024

I have a way to work around this issue, but still not perfect:
multiline_start_regexp /[\d-]+ [\d:.]+ *ERROR/

so, only error stack trace is printed, the multiline plugin is activated. of course, this config suppose you print stack trace only when error happened.

but this is not perfect as well, because when an error printed, if there is no more preceding logs, this error may not be flushed

from fluent-plugin-concat.

mindw avatar mindw commented on May 27, 2024

Something like this from fluentd 0.12.20+:

multiline_flush_interval

The interval of flushing the buffer for multiline format. The default is disabled.

If you set multiline_flush_interval 5s, in_tail flushes buffered event after 5 seconds from last emit. This option is useful when you use format_firstline option. Since v0.12.20 or later.

from fluent-plugin-concat.

okkez avatar okkez commented on May 27, 2024

Is there really no way to simply close a multiline capture when timeout is reached and process like normal?

There is no way.
This plugin is filter, so we cannot emit normal event. In fact, filter cannot emit normal event. It is difference from output plugin.

The other plugins from fluentd, like the memory buffer ones seems to be able to simply apply a flush interval to their processing, at which point all the collected stuff simply goes on to be processed normally.

Those plugins are output plugin. But this is filter plugin.
We don't use Fluentd's buffer mechanism in this plugin.

from fluent-plugin-concat.

mindw avatar mindw commented on May 27, 2024

Got it. An unfortunate fluentd limitation.

from fluent-plugin-concat.

okkez avatar okkez commented on May 27, 2024

I've got a solution for this issue, but it is not perfect and not implemented.

  • Add new configuration soft_flush_interval, this counts timeout in main thread
  • if Fluentd does not send events to this filter plugin:
    • soft_flush_interval: does not flush buffer
    • flush_interval: flush buffer and timeout error occur
  • if Fluentd sends events but not the end of multline:
    • soft_flush_interval: flush buffer as normal events
    • flush_interval: flush buffer and timeout error occur (if soft_flush_interval > flush_interval: this means soft_flush_interval is disabled)
  • This solution introduces complexity to this pluigin

Is this enough or not?

from fluent-plugin-concat.

vladm avatar vladm commented on May 27, 2024

@okkez this would not really help my case as when output happens, it always starts with a start-line followed by some arbitrary number of lines. Then there can be no output for prolonged period of time and new event that starts with a start-line.

from fluent-plugin-concat.

okkez avatar okkez commented on May 27, 2024

Thanks you for comments.
I will add this to README.md.

from fluent-plugin-concat.

macavity23 avatar macavity23 commented on May 27, 2024

@mdamir 's workaround works nicely! Thanks :)

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.