#NEWLINE# def format( self , filename , line , timestamp , **kwargs ) : #NEWLINE# #INDENT# 'Returns a formatted log line' #NEWLINE# line = unicode ( line . encode ( 'utf-8' ) [ : 32766 ] , 'utf-8' , errors = 'ignore' ) #NEWLINE# formatter = self . _beaver_config . get_field ( 'format' , filename ) #NEWLINE# if ( formatter not in self . _formatters ) : #NEWLINE# #INDENT# formatter = self . _default_formatter #NEWLINE# #UNINDENT# data = { #NEWLINE# #INDENT# self . _fields . get ( 'type' ) : kwargs . get ( 'type' ) , #NEWLINE# self . _fields . get ( 'tags' ) : kwargs . get ( 'tags' ) , #NEWLINE# '@timestamp' : timestamp , #NEWLINE# self . _fields . get ( 'host' ) : self . _current_host , #NEWLINE# self . _fields . get ( 'file' ) : filename , #NEWLINE# self . _fields . get ( 'message' ) : line , #NEWLINE# #UNINDENT# } #NEWLINE# if ( self . _logstash_version == 0 ) : #NEWLINE# #INDENT# data [ '@source' ] = 'file://{0}' . format ( filename ) #NEWLINE# data [ '@fields' ] = kwargs . get ( 'fields' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# data [ '@version' ] = self . _logstash_version #NEWLINE# fields = kwargs . get ( 'fields' ) #NEWLINE# for key in fields : #NEWLINE# #INDENT# data [ key ] = fields . get ( key ) #NEWLINE# #UNINDENT# #UNINDENT# return self . _formatters [ formatter ] ( data )