[2018-09-20 08:25:21,635:错误/主进程]测试[b48600fc-70d1-4f44-9b7a-1988c3ca5cc4]引发意外:MaxRetriesExceededError(“无法重试test.api.tasks。 send_webhook [b43-23-24442-3sfa-23] args:(u'http://test.com/private_token=0101032030301',{'content-type':'application / json'},{'date_created':'2018-09-19T22: 33:57.602599','type':'foo.created','data':{'status':'settled','date_completed':'2018-09-20T02:25:17','target':{'商人':无,'可兑换目标':无,'电话':无,'用户':{'用户名':u'tato','关于':'','姓氏':u'Teette','display_name' :u'ttead','test_count':90,'is_active':True,'is_group':False,'trust_request':无,'id':'0000000100203','phone':无,'profile_picture_url':u' https://test.test.com/u/','first_name':u'Test','friend_status':无,'is_blocked':False,'email':无,'identity':无,'date_joined':'2015-08-19T11 :16:36'},'type':'user','email':None},'audience':u'friends','actor':{'username':u'test','about':' ','last_name':u'test','display_name':u'Michael Bi ttinger','friends_count':52,'is_active':True,'is_group':False,'trust_request':无,'id':'39219321939133333','phone':无,'profile_picture_url':u'{{3 }}','first_name':u'testt','ttt_status':无,'is_blocked':False,'email':无,'identity':无,'date_joined':'2017-09-01T22:20: 12'},'note':u'\ U0001f4bb \ U0001f4b8','amount':27.52,'action':'hit','date_created':'2018-09-20T02:25:17','date_reminded':无,'id':'3213131333323','date_authorized':无}})kwargs:{}“,)
嘿,上面的日志是我通过fluentd传递给Elasticsearch的内容。
我需要能够过滤“ private_token:”,并确保将其屏蔽或替换为其他内容,使其看起来像这样。 “ https://test.teee.com/u/'”或FluentD的实际值以外的任何值。
答案 0 :(得分:0)
答案 1 :(得分:0)
当我想屏蔽密码时,我在fluentd conf文件中添加了一个带有以下conf的过滤器。
<filter **>
@type record_transformer
enable_ruby
<record>
message ${record["message"].gsub(/[Pp]assword*([^,])/,'****')}
</record>
</filter>