修改mcollective的audit支持syslog

修改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
时间: 2024-08-06 15:52:04

修改mcollective的audit支持syslog的相关文章

audit和syslog之间的渊源

audit的目的: 记录核心层的事件,档案的读写,系统的呼叫.权限的状态 属于内核 syslog的目的: 属于应用层,记录的都是应用层的错误信息 audit 有三個操作的工具 audit 可用的三個指令: => auditctl - 控制 kernel audit system,能取得狀態,增或刪除rules.設定某個檔案的「檢視」(watch). => ausearch - 用來查詢 audit logs 的工具. => aureport - 產生 audit 系統簡報的工具. 4.

转载 修改 Linux 内核 DM9000 支持 tiny210 开发板

错误现象: dm9000 dm9000: read wrong id 0x2b2a2928dm9000 dm9000: wrong id: 0x2b2a2928dm9000 dm9000: not found (-19). TCP cubic registeredNET: Registered protocol family 17Registering the dns_resolver key typeVFP support v0.3: implementor 41 architecture 3

【server端学习】修改Apache配置使支持shtml

主要工作:修改httpd.conf文件[步骤一]去掉下面两行的注释#AddType text/html .shtml #AddOutputFilter INCLUDES .shtml [步骤二]在Options Indexes FollowSymLinks 后面加上Includes ================================================================================================= 以下内容来自http

flask修改flask_wtf使其支持json数据的validation验证

flask默认是前后端不分离策略,前端通过flask+wtf表单来传递post,put...等数据. 现在前后端分离是趋势,那么对flask进行一定的修改,变为前后端分离,在前端页面中请求后端,那么请求的格式那么必然会有使用json传递数据,然而flask_wtf默认只支持form表单,那么对改动支持json 代码如下: 1 # coding=utf-8 2 3 from flask import request 4 from wtforms import Form 5 from OnlineC

修改Linux系统参数以支持单机同时打开数百万文件句柄

在linux kernel 2.6.25之前通过ulimit -n(setrlimit(RLIMIT_NOFILE))设置每个进程的最大打开文件句柄数不能超过NR_OPEN (1024*1024),也就是100多w(除非重新编译内核),而在2.6.25之后,内核导出了一个sys接口可以修改这个最大值(/proc/sys/fs /nr_open). 具体的changelog: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.gi

修改mysql开启innodb支持

1.找到/etc/my.cnf文件 a. 修改默认引擎 b. 注释掉: loose-skip-innodb c.打开被注释掉的innodb配置 2.重启服务器  /etc/init.d/mysql restart 原文地址:https://www.cnblogs.com/yuwensong/p/10855804.html

如何修改bootstrap的popover支持鼠标移到弹出层上弹窗层不隐藏

1 设置延时, 超过该延时未移入弹窗则弹窗隐藏 Tooltip.prototype.init = function{中的 var triggers = this.options.trigger.split(' ')后面加上 //设置延时 if (this.options.trigger.indexOf('hover') > -1) { $.extend(true, this.options, { delay: { hide: 100 } }); } 2 控制不消失代码 在Tooltip.prot

codeingiter修改版本支持多module

最近刚入职一家公司发现该公司采用的框架是古老的CI1.7.2加matchbox扩展而来的遂研究一翻 发现直接在其中进行升级有些麻烦索性修改新发布的CI3.0 为多module支持 现贡献给大家使用 此版本是在CI3.0版本的基础上修改开发出来的 此版本的框架对CI3.0进行了HMVC扩展 此扩展主要通过 EX_Loader.php文件进行扩展 简要说明如下: 1.application下为应用目录 2.common为公共文件夹 其中可以存放公共配置文件,核心文件,帮助文件,hooks, lang

支持区间修改的树状数组

支持区间修改的树状数组 原理 对于一个数组\(a\),以及\(a\)的差分\(c\),显然有\(c[i]=a[i]-a[i-1]\) 那么对于数组a的前缀和有 \(\sum_{i=1}^n{a_i}=c[1]+(c[1]+c[2])+...(c[1]+c[2]+...+c[n])\) 进一步的: \(\sum_{i=1}^n{a_i}=c[1]*n+c[2]*(n-1)+...+c[n]*(n-n+1)\) 展开括号内 \(\sum_{i=1}^n{a_i}=c[1]*n+c[2]*n+...+