type tail
path /var/log/salt/returner
pos_file /tmp/return_pos.log
tag os.salt
format /\"(?.*)\", \"(?\d+)\", (?.*), \"(?.*)\", (?.*)/
type forward
flush_interval 1s
host
port
服务端配置:
type forward
port 24224
bind 0.0.0.0
type mysql
host localhost
database fluent
username fluent
password fluent
key_names jid,id,fun,return,success
sql INSERT INTO salt_returns (jid,host_id,fun,`return`,success) VALUES (?,?,?,?,?)
flush_interval 5s
结果查询:
select * from salt_returns where success is not NULL and fun='cmd.run' limit 1;
+------+----------------------+-----------------------------------------+---------------------+---------+---------+---------+
| id | jid | host_id | time | fun | return | success |
+------+----------------------+-----------------------------------------+---------------------+---------+---------+---------+
| 2571 | 20130531184127393793 | test | 2013-05-31 10:38:29 | cmd.run | "/root" | true |
+------+----------------------+-----------------------------------------+---------------------+---------+---------+---------+