具有follow模式的cli graylog客户端
bonfire的Python项目详细描述
bonfire是一个命令行界面,用于通过rest api查询graylog搜索。它试图模拟在本地文件上使用tail的感觉。
用法
示例:
> bonfire -h logserver -u jdoe -@ "10 minutes ago" "*" ... > bonfire -h logserver -u jdoe -f "source:localhost AND level:2" ...
篝火用法:
Usage: bonfire [OPTIONS] [QUERY] Bonfire - An interactive graylog cli client Options: --node TEXT Label of a preconfigured graylog node -h, --host TEXT Your graylog node's host -s, --tls Use HTTPS --port INTEGER Your graylog port (default: 12900) -u, --username TEXT Your graylog username -p, --password TEXT Your graylog password (default: prompt) -k, --keyring / -nk, --no-keyring Use keyring to store/retrieve password -@, --search-from TEXT Query range from -#, --search-to TEXT Query range to (default: now) -t, --tail Show the last n lines for the query (default) -d, --dump Print the query result as a csv -o, --output TEXT Output logs to file (only tail/dump mode) -f, --follow Poll the logging server for new logs matching the query (sets search from to now, limit to None) -l, --interval INTEGER Polling interval in ms (default: 1000) -n, --limit INTEGER Limit the number of results (default: 10) -a, --latency INTEGER Latency of polling queries (default: 2) -r, --stream TEXT Stream ID of the stream to query (default: no stream filter) -e, --field TEXT Fields to include in the query result -x, --template-option TEXT Template options for the stored query -s, --sort TEXT Field used for sorting (default: timestamp) --asc / --desc Sort ascending / descending --help Show this message and exit.
配置
可以配置篝火。它将查找~/.bonfire.cfg或bonfire.cfg(在当前目录中)。这个 配置文件可以指定api节点。如果未指定主机,则将使用名为default的节点。你可以 还可以通过使用冒号开始查询来配置可以引用的查询:
[node:default] host=1.2.3.4 port=12900 username=jdoe [node:dev] host=4.3.2.1 port=12900 username=jdoe [query:example] query=facility:*foo* AND source:*bar* from=2015-03-01 15:00:00 limit=100 fields=message,name,facility,source
现在您可以通过以下方式运行查询:
> bonfire --node=dev :example ... runs the example query on the node dev > bonfire :example ... runs the example query on the default node
查询模板
选项
查询
已知错误
- Bonfire希望Graylog的时区是UTC。
发行说明
- v0.0.7:问题修复、tls和代理支持
- 添加对https url的支持
- 将时间戳添加到转储格式
增加代理的支持< /LI>
- v0.0.6:文档修复
- readme.rst的更改
- v0.0.5:清理
- 删除了终端用户界面的想法
- 添加了第一个测试
- 带时区的固定日期和时间处理
- 添加了python3兼容性
- v0.0.4:扩展文档和流访问
- 如果未指定流且用户没有全局搜索权限,请使用用户有权访问的第一个流
- v0.0.3:小修正
- 在get请求中使用accept header。
- 修复查询特定字段时的错误
- v0.0.1:初始释放
- 有限的功能集。