index.js
function logstashLayout(logEvt, fields) {
    var messageData = logEvt.data[0], 
        log = {
            '@timestamp': (new Date()).toISOString(),
            '@fields': {
                category: logEvt.categoryName,
                level: logEvt.level.levelStr
            },
            '@message' : (toType(messageData) === "string") ? messageData : JSON.stringify(messageData)
        }
    
    for (var key in fields) {
        if (typeof fields[key] !== 'function') {
            log['@fields'][key] = fields[key];
        }
    }

    return JSON.stringify(log) + '\n';
}
function logstashLayout(logEvt, fields) {
    var messageData = logEvt.data[0], 
        log = {
            '@timestamp': (new Date()).toISOString(),
            '@fields': {
                category: logEvt.categoryName,
                level: logEvt.level.levelStr
            },
            '@message' : (toType(messageData) === "string") ? messageData : JSON.stringify(messageData)
        }
    
    for (var key in fields) {
        if (typeof fields[key] !== 'function') {
            log['@fields'][key] = fields[key];
        }
    }

    return JSON.stringify(log) + '\n';
}
function logstashLayout ( logEvt , fields ) { var messageData = logEvt . data [ 0 ] , log = { '@timestamp' : ( new Date ( ) ) . toISOString ( ) , '@fields' : { category : logEvt . categoryName , level : logEvt . level . levelStr } , '@message' : ( toType ( messageData ) === "string" ) ? messageData : JSON . stringify ( messageData ) } for ( var key in fields ) { if ( typeof fields [ key ] !== 'function' ) { log [ '@fields' ] [ key ] = fields [ key ] ; } } return JSON . stringify ( log ) + '\n' ; }
Simple layout parser for logstash message.
If message type is not string, parser will convert message into string using JSON.stringify.

@param logEvt, fields
@returns {{@timestamp: string, @fields: {category: (categoryName|*), level: (levelStr|*)}}}
Simple layout parser for logstash message . If message type is not string parser will convert message into string using JSON . stringify .