question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enhance Log Topics for Pulsar Functions

See original GitHub issue

Is your feature request related to a problem? Please describe. When using the logTopic feature of Pulsar Functions it works great, but seems a bit limited in it’s usage as only the message body is being sent to the logTopic as byte[].

Describe the solution you’d like Add an additional LogAppender.append method override that allows for the org.apache.logging.log4j.core.LogEvent object to be sent to the logTopic directly or allow the logTopic to except a custom schema and not just byte[]. This would allow consumers of the log topic to decipher what messages are of type INFO, WARN, ERROR, etc. The metadata in the org.apache.logging.log4j.core.LogEvent objects could be very valuable on the log consumption and analytics side.

src/main/java/org/apache/pulsar/functions/instance/LogAppender.java

Original

@Override
    public void append(LogEvent logEvent) {
        producer.sendAsync(logEvent.getMessage().getFormattedMessage().getBytes());
    }

Potential future maybe?

@Override
    public void append(LogEvent logEvent) {
        producer.sendAsync(logEvent);
    }

Describe alternatives you’ve considered I have considered creating a custom schema and topic and then just having my functions publish to that via the following and not using the built in Logger at all: context.newOutputMessage((Log) topicToWrite.get(), Schema.LOG).value(input).sendAsync();

I would rather use the functions built in Logger if at all possible.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jerrypengcommented, Jul 25, 2019

@one70six sounds good to me. We can even produce the logs with a schema e.g.

| level | classpath | message| |INFO | org.apache.logging.log4j.core.LogEvent| foo

0reactions
tisonkuncommented, Dec 9, 2022

Closed as stale. Please create a new issue if it’s still relevant to the maintained versions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Produce function logs - Apache Pulsar
Pulsar Functions that use the Java SDK have access to an SLF4j Logger object. The logger object can be used to produce logs...
Read more >
Using Pulsar Functions: Log Topics - YouTube
Streamlio's Sanjeev Kulkarni explains how to generate and record log messages from Pulsar Functions using logging topics.
Read more >
Pulsar Functions Deep Dive - StreamNative
These lightweight compute functions consume messages from one or more Pulsar topics, apply user-supplied processing logic to each message, and ...
Read more >
Developing and Running Serverless Apache Pulsar Functions
Logs will be stored in a dedicated topic, called filter-log which we need to create and provide in the Function configuration. Package. You...
Read more >
Event Processing Design Patterns with Pulsar Functions
In this blog post we presented several common stream processing pattern implementations using Apache Pulsar Functions. These processing patterns ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found