Git Product home page Git Product logo

Comments (3)

okkez avatar okkez commented on July 22, 2024

Some winston transports don't support custom formatter and other options.
For example, console transports and file transports support them, but http transports and memory transports don't.

Could you describe what do you want to do? I cannot imagine your situation.
I think timestamp which is added by fluent-logger is enough.

from fluent-logger-node.

rqc avatar rqc commented on July 22, 2024

Thanks for your response @okkez. My scenario is the following (I am a newbie with fluentd so please let me know if I have other options to do this):

  • Setup fluent-logger to output directly to fluentd including a timestamp as part of the body of the collected message itself.
  • This message is stored in elasticsearch and it should have the timestamp included as part of the message.

Instead, what is happening is that we are receiving the messages stored in elasticsearch, but we only have the timestamp (from what I can see) of the storage in elasticsearch and not the actual timestamp of the fluent-logger. Perhaps I can do some filtering / formatting in fluentd conf to extract the timestamp and inject it in the message's body?

from fluent-logger-node.

okkez avatar okkez commented on July 22, 2024

Thank you for describing your case.

You can use filter_record_transformer in such case.
http://docs.fluentd.org/articles/filter_record_transformer

<source>
  @type forward
  @label @TEST
</source>

<label @TEST>
  <filter>
    @type record_transformer
    <record>
       timestamp ${time}
    </record>
  </filter>

  <match **>
    @type elasticsearch
    # ... snip ...
  </match>
</label>

I don't confirm this configuration.
If you want inject timestamp into the message, see following example:

<filter>
  @type record_transformer
  message ${time} ${record["message"]}
</filter>

from fluent-logger-node.

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.