Browse Source

add some comments

distributed
loveshell 12 years ago
parent
commit
6c1ec6b005
  1. 4
      waf.lua

4
waf.lua

@ -1,3 +1,4 @@
--发送syslog数据函数
function syslog(msg) function syslog(msg)
ngx.header.content_type = "text/html" ngx.header.content_type = "text/html"
kern = 0 kern = 0
@ -33,6 +34,7 @@ function syslog(msg)
local sock = ngx.socket.udp() local sock = ngx.socket.udp()
local ok, err = sock:setpeername('127.0.0.1', 514) local ok, err = sock:setpeername('127.0.0.1', 514)
--上面的ip和端口就是syslog server的ip和端口地址,可自行修改
if not ok then if not ok then
ngx.say("failed to connect to syslog server: ", err) ngx.say("failed to connect to syslog server: ", err)
return return
@ -43,7 +45,7 @@ sign=level+facility*8
ok, err = sock:send('<'..sign..'>'..msg) ok, err = sock:send('<'..sign..'>'..msg)
sock:close() sock:close()
end end
--日志处理函数
function log(method,url,data) function log(method,url,data)
file=assert(io.open("/data/logs/hack/"..ngx.var.server_name.."_sec.log","a")) file=assert(io.open("/data/logs/hack/"..ngx.var.server_name.."_sec.log","a"))

Loading…
Cancel
Save