public class LogstashFormatter extends JsonFormatter
JSON formatter which adds the @version to the generated JSON and overrides the
timestamp key to @timestamp.
The default version is 1.
StructuredFormatter.ExceptionOutputType, StructuredFormatter.Generator, StructuredFormatter.Key| Constructor and Description |
|---|
LogstashFormatter()
Create the lostash formatter.
|
LogstashFormatter(Map<StructuredFormatter.Key,String> keyOverrides)
Create the logstash formatter overriding any default keys
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
before(StructuredFormatter.Generator generator,
ExtLogRecord record)
Invoked before the structured data is added to the generator.
|
int |
getVersion()
Returns the version being used for the
@version property. |
void |
setVersion(int version)
Sets the version to use for the
@version property. |
createGenerator, isPrettyPrint, setPrettyPrintafter, format, getDateTimeFormatter, getEndOfRecordDelimiter, getExceptionOutputType, getKey, getMetaData, getZoneId, isCallerCalculationRequired, isDetailedExceptionOutputType, isFormattedExceptionOutputType, isPrintDetails, setDateFormat, setEndOfRecordDelimiter, setExceptionOutputType, setMetaData, setPrintDetails, setZoneIdformatformatMessage, getHead, getTailpublic LogstashFormatter()
public LogstashFormatter(Map<StructuredFormatter.Key,String> keyOverrides)
keyOverrides - the keys used to override the defaultsprotected void before(StructuredFormatter.Generator generator, ExtLogRecord record) throws Exception
StructuredFormatterbefore in class StructuredFormattergenerator - the generator to userecord - the log recordExceptionpublic int getVersion()
@version property.public void setVersion(int version)
@version property.version - the version to useCopyright © 2017 JBoss by Red Hat. All rights reserved.