本文主要是介绍【开源】Zeek编程之:日志添加自定义字段,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
转载,可参照文中叙述方法对日志字段扩展添加自己想要的内容,比如本采集器IP等
添加自定字段,如human_readable time字段:
FILE $bro/share/bro/base/protocols/http/human_time_http.bro
@load base/protocols/httpmodule HTTP;export {redef record Info += {## A human-readable timestamphuman_time: string &log &optional;};}event http_request(c: connection, method: string, original_URI: string,unescaped_URI: string, version: string){local format: string = "%Y-%m-%dT%H:%M:%S%z";c$http$human_time = strftime(format, c$http$ts);}
之后修改load文件$bro/share/bro/base/protocols/http/load.bro,添加一行
@load ./human_time_http
最后在$bro/share/bro/base/protocols/http/main.bro中添加新建的字段
type Info: record { ## Timestamp for when the request happened.human_time: string &log;......
另:bro script中字段含义https://www.bro.org/sphinx/script-reference/attributes.html#attr-&log
作者:phaker
链接:https://www.jianshu.com/p/0657fb041393
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
这篇关于【开源】Zeek编程之:日志添加自定义字段的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!