修改mcollective的audit支持syslog
2014-12-08 17:55
162 查看
修改Mcollective支持syslog输出,同时将默认的utc时间修改为本地时间。
module MCollective module RPC # An audit plugin that just logs to a file # # You can configure which file it logs to with the setting # # plugin.rpcaudit.logfile class Logfile<Audit require 'pp' require 'syslog' def audit_request(request, connection) logfile = Config.instance.pluginconf["rpcaudit.logfile"] || "/var/log/mcollective-audit.log" now = Time.now.strftime("%F %X") File.open(logfile, "a") do |f| f.puts("[#{now}] reqid=#{request.uniqid}: reqtime=#{request.time} caller=#{request.caller}@#{request.sender} agent=#{request.agent} action=#{request.action} data=#{request.dat a.pretty_print_inspect}") end Syslog.open('mcollective',Syslog::LOG_PID,Syslog::LOG_LOCAL4) do |f| f.log(Syslog::LOG_INFO,"[#{now}] reqid=#{request.uniqid}: reqtime=#{request.time} caller=#{request.caller}@#{request.sender} agent=#{request.agent} action=#{request.action} da ta=#{request.data.pretty_print_inspect}") end end end end end
相关文章推荐
- Axure RP Pro - 相关问题 - Listbox列表框部件不支持修改选项
- 修改织梦dedecms自带的网站地图路径和网站地图获取文章列表支持标签调用的方法
- libav的avplay修改支持sdl2.0
- 代码修改Webservice的地址,支持同步和异步方式
- 数据库分库分表(sharding)系列(五) 一种支持自由规划无须数据迁移和修改路由代码的Sharding扩容方案
- 让PHPCms内容页支持JavaScript的修改方法
- 桌面支持--PPT2010母版中的背景如何修改与设置
- Asp.Net中不修改IIS实现URL重写,支持任意扩展名及无扩展名
- 配置修改Nginx支持 PATHINFO
- 修改windows支持的远程桌面最大用户数
- VisualSVN server修改钩子支持编辑日志
- pligg9.7beta搭起后HTML编辑器插件的安装(fckeditor的配置与修改变相支持中文文件名)
- 编译修改tomcat7源码,支持同时设置允许ip和域名
- Flume NG源码分析(二)支持运行时动态修改配置的配置模块
- 修改Mysql 字符集,支持Emoji表情(如搜狗的自定义表情大字符)
- 修改代码令TMS组件库的THTMLLabel控件支持中文换行
- 修改nginx1.2.4 conf 支持path_info
- Syncfusion Editor组件支持中文修改(初步)
- android系统支持app2sd(修改boot.img)
- 基于CSerialPort修改类的串口调试助手源代码(支持中文、自动保存等)