@@ -13,10 +13,8 @@ class LogstashHandler(DatagramHandler):
13
13
:param fqdn; Indicates whether to show fully qualified domain name or not (default False).
14
14
"""
15
15
16
- def __init__ (self , host , port = 5959 , message_type = 'logstash' ,
17
- message_path = 'logstash' , fqdn = False ):
16
+ def __init__ (self , host , port = 5959 , message_type = 'logstash' , fqdn = False ):
18
17
self .message_type = message_type
19
- self .message_path = message_path
20
18
self .fqdn = fqdn
21
19
DatagramHandler .__init__ (self , host , port )
22
20
@@ -38,9 +36,9 @@ def build_message(self, record):
38
36
'logger' : record .name ,
39
37
},
40
38
'@message' : record .getMessage (),
41
- '@source' : self .format_source (host ),
39
+ '@source' : self .format_source (host , record . pathname ),
42
40
'@source_host' : host ,
43
- '@source_path' : self . message_path ,
41
+ '@source_path' : record . pathname ,
44
42
'@tags' : [],
45
43
'@timestamp' : self .format_timestamp (record .created ),
46
44
'@type' : self .message_type ,
@@ -52,7 +50,6 @@ def build_message(self, record):
52
50
53
51
if add_debug_info :
54
52
message_dict ['@fields' ]['lineno' ] = record .lineno
55
- message_dict ['@fields' ]['pathname' ] = record .pathname
56
53
message_dict ['@fields' ]['process' ] = record .process
57
54
message_dict ['@fields' ]['threadName' ] = record .threadName
58
55
# funName was added in 2.5
@@ -90,5 +87,5 @@ def format_exception(self, exc_info):
90
87
def format_timestamp (self , time ):
91
88
return datetime .utcfromtimestamp (time ).isoformat ()
92
89
93
- def format_source (self , host ):
94
- return "%s://%s/%s" % (self .message_type , host , self . message_path )
90
+ def format_source (self , host , path ):
91
+ return "%s://%s/%s" % (self .message_type , host , path )
0 commit comments