无论才能、知识多么卓著,如果缺乏热情,则无异纸上画饼充饥,无补于事。

elastalert规则文件rule中文显示乱码

默认分类 | 作者 jhondom | 发布于2019年04月10日 | 阅读数:391

vi编辑elastalert的rule文件,通过elastalert-test-rule测试报错如下:
Traceback (most recent call last):
  File "/usr/local/bin/elastalert-test-rule", line 11, in <module>
    load_entry_point('elastalert==0.1.38', 'console_scripts', 'elastalert-test-rule')()
  File "/usr/local/lib/python2.7/site-packages/elastalert-0.1.38-py2.7.egg/elastalert/test_rule.py", line 463, in main
    test_instance.run_rule_test()
  File "/usr/local/lib/python2.7/site-packages/elastalert-0.1.38-py2.7.egg/elastalert/test_rule.py", line 430, in run_rule_test
    rule_yaml = load_rule_yaml(args.file)
  File "/usr/local/lib/python2.7/site-packages/elastalert-0.1.38-py2.7.egg/elastalert/config.py", line 145, in load_rule_yaml
    loaded = yaml_loader(filename)
  File "/usr/local/lib/python2.7/site-packages/PyStaticConfiguration-0.10.4-py2.7.egg/staticconf/loader.py", line 168, in yaml_loader
    return yaml.load(fh, Loader=SafeLoader) or {}
  File "build/bdist.linux-x86_64/egg/yaml/__init__.py", line 114, in load
  File "build/bdist.linux-x86_64/egg/yaml/constructor.py", line 43, in get_single_data
  File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 36, in get_single_node
  File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 55, in compose_document
  File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 84, in compose_node
  File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 133, in compose_mapping_node
  File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 82, in compose_node
  File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 111, in compose_sequence_node
  File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 84, in compose_node
  File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 133, in compose_mapping_node
  File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 82, in compose_node
  File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 111, in compose_sequence_node
  File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 84, in compose_node
  File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 133, in compose_mapping_node
  File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 84, in compose_node
  File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 127, in compose_mapping_node
  File "build/bdist.linux-x86_64/egg/yaml/parser.py", line 98, in check_event
  File "build/bdist.linux-x86_64/egg/yaml/parser.py", line 428, in parse_block_mapping_key
  File "build/bdist.linux-x86_64/egg/yaml/scanner.py", line 116, in check_token
  File "build/bdist.linux-x86_64/egg/yaml/scanner.py", line 159, in fetch_more_tokens
  File "build/bdist.linux-x86_64/egg/yaml/scanner.py", line 780, in scan_to_next_token
  File "build/bdist.linux-x86_64/egg/yaml/reader.py", line 103, in forward
  File "build/bdist.linux-x86_64/egg/yaml/reader.py", line 170, in update
yaml.reader.ReaderError: 'utf8' codec can't decode byte #xb8: invalid start byte
  in "/app/elastalert/rules/wechat/app_frequency_wechat01.yaml", position 2471
 
请指教
 
QQ截图20190410115345.jpg
已邀请:

jhondom

赞同来自:

已经解决。rule文件编码格式统一后正常。

要回复问题请先登录注册