Skip to content

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