Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate logstash event creation from formatting operation #51

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

talvey
Copy link

@talvey talvey commented Jan 7, 2015

I've performed a very simple refactoring to expose the logstash json event to subclasses of JSONEventLayoutV1. The intent is to allow subclasses to override the format method and still be able to use the default logstash event creation logic.

So, something like the following:

    @Override
    public String format(LoggingEvent loggingEvent) {
       JSONObject logstashJson = createLogstashEvent(loggingEvent);
        String[] tags = new String[] {"CustomHardcodedTag"};
        logstashJson.put("tags", tags);

        return logstashJson.toString() + "\n";    
    }

Alvey, Travis added 4 commits December 30, 2014 22:21
… the creation of the Logstash event and the formatting operation. The benefit is subclasses of JSONEventLayoutV1 can create the Logstash event, add any specific details to the event, and then get the formatted string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant