Comments (9)
In what context do you get this error? I assume you are trying to build a lua rule or lua module? Perhaps you can post an example of what you are trying to do.
from ironbee.
I'm sorry. i have done some mistake. I am trying to build lua rule.
I got another error: "attempt to call method 'logInfo' (a nil value)".
example of whai i am trying to do:
local ib = ...
if ib == nil then
return 0
end
ib:logInfo("Testing")
return 0
from ironbee.
Instead of lua rules, I suggest using lua modules. It is very likely that lua rules will be deprecated in favor of modules. This is primarily since writing lua modules has become so easy and is much more flexible and performant than lua rules.
You can use the clipp utility to test this with raw HTTP request.http and response.http files (this is with latest master ironbee):
clipp raw:request.http,response.http ironbee:ironbee-lua.conf
ironbee-lua.conf:
### Logging
LogLevel info
### Load Modules
LoadModule "ibmod_htp.so"
LoadModule "ibmod_lua.so"
LuaLoadModule "test.lua"
### Auditing
AuditEngine RelevantOnly
AuditLogIndex auditlog-index.log
AuditLogBaseDir /tmp/ironbee
AuditLogSubDirFormat "%Y%m%d-%H%M"
AuditLogDirMode 0755
AuditLogFileMode 0644
AuditLogParts all
### Buffering
RequestBuffering On
ResponseBuffering On
### Rule Diagnostics Logging
RuleEngineLogData event audit
RuleEngineLogLevel info
#Set RuleEngineDebugLogLevel Trace
### Sites
<Site default>
SiteId 95AB11F0-B195-480C-AF0B-752E98AEB20E
Service *:*
Hostname *
</Site>
test.lua:
-- ========================================================
-- Lua test module.
--
-- This code is executed on load (LuaLoadModule directive).
-- ========================================================
-- Get an IronBee module handle, passed in as an argument.
local ibmod = ...
if ibmod == nil then
-- Return failure (non-zero).
return 1
end
ibmod:logInfo("Loading module: test.lua")
-- Callback to process the request header.
local process_request_header = function(tx)
tx:logInfo("Processing request header.")
-- Iterate and log out defined fields.
for _,name in ipairs(tx:getFieldList()) do
tx:logInfo("FIELD: %s", name)
local f = tx:get(name)
if type(f) == "table" then
for _,rec in ipairs(f) do
local k,v = unpack(rec)
tx:logInfo("%s:%s[%s] = %s", name, k, type(v), tostring(v))
end
else
tx:logInfo("%s[%s] = %s", name, type(f), tostring(f))
end
end
-- Return success (zero).
return 0
end
-- Register callbacks with events.
ibmod:request_header_finished_event(process_request_header)
ibmod:logInfo("Finished loading module: test.lua")
-- Return success (zero).
return 0
from ironbee.
I did it, but when I tried using rex_pcre,, error loading module 'rex_pcre' from file '/usr/local/lib/lua/5.1/rex_pcre.so' appears.
test.lua
local ibmod = ...
local rex = require 'rex_pcre'
if ibmod == nil then
return 1
end
ibmod:logInfo("Loading module : test.lua -- Fajri Rahmat")
local process_request_header = function(tx)
tx:logInfo("Processing request header")
for _,name in ipairs(tx:getFieldList()) do
tx:logInfo("FIELD : %s", name)
local f = tx:get(name)
if type(f) == "table" then
for _,rec in ipairs(f) do
local k,v = unpack(f)
tx:logInfo("%s:%s[%s] = %s -- Fajri Rahmat",name,k,type(v), tostring(v))
end
else
tx:logInfo("%s[%s] = %s",name,type(f),tostring(f))
end
end
return 0
end
ibmod:request_header_finished_event(process_request_header)
ibmod:logInfo("Finished loading module : test.lua")
return 0
from ironbee.
What is the full error you are getting? If it is not finding the rex_pcre, then perhaps you need to append to the package.cpath?
package.cpath = package.cpath .. ";/usr/local/share/luarocks/lib/lua/5.1/?.so"
local rex = require 'rex_pcre'
from ironbee.
Error as following :
ironbee: 02022014.09h08m51s ERROR - Error loading module /usr/local/ironbee/etc/ironbee/test.lua: error loading module 'rex_pcre' from file '/usr/local/lib/lua/5.1/rex_pcre.so':\n\t/usr/local/lib/lua/5.1/rex_pcre.so: undefined symbol: lua_checkstack
this error only appear when I try to use 'rex_pcre' at lua module.
from ironbee.
I have a fix in latest master (1599825). Can you try this version?
from ironbee.
oke ,, thank's. it works...
from ironbee.
Excellent. Thanks for testing.
from ironbee.
Related Issues (20)
- ironbee dies if there is a body in response to HEAD request HOT 5
- File descriptor leak fix HOT 3
- Sync libinjection to latest HOT 4
- sync libinjection to 1.1.0 HOT 6
- Sync libinjection to 1.2.0 HOT 1
- make check error HOT 8
- make nginx error HOT 11
- make test error : ipset HOT 3
- nginx reload causes complete failure of all requests HOT 14
- "unknown directive ironbee_loglevel" in nginx HOT 3
- Register Directive Error HOT 3
- nginx/1.7.0 and ironbee logging problem HOT 16
- ld command not picking boost libraries HOT 1
- centos 6.5 make errors out with error libironbee_la-core.lo HOT 12
- Ubuntu 14.04 error HOT 2
- Nginx with Ironbee rpms HOT 8
- Cannot find mod_ironbee.so
- Getting errors while executing the 'make' command
- Site dead? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ironbee.