我正在尝试使用以下记录来解析日志文件:
Apr 29 06:56:48 example-server sshd[38254]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=123.183.209.132 user=root
Apr 29 06:56:50 example-server CRON[33299]: pam_unix(cron:session): session closed for user root
Apr 29 06:56:50 example-server sshd[38254]: Failed password for root from 123.183.209.132 port 55181 ssh2
Apr 29 06:56:56 example-server sshd[38254]: message repeated 2 times: [ Failed password for root from 123.183.209.132 port 55181 ssh2]
Apr 29 06:56:59 example-server sshd[38254]: fatal: Read from socket failed: Connection reset by peer [preauth]
Apr 29 06:56:59 example-server sshd[38254]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=123.183.209.132 user=root
我正在尝试使文件腌制
with open('auth.log', 'rb') as logs:
db = pickle.load(logs)
我收到错误消息:
TypeError: a bytes-like object is required, not 'str'
答案 0 :(得分:0)