Screenshot 135 - Creating a template for sending logs to a third-party SIEM system
Template examples:
LEEF format template:
'{{time}} {{host_ip}} LEEF:2.0|iBatyr WAF|1.0|{{req.obj_id}}|src={{req.src_ip}}\tspt={{req.src_port}}\tdst={{req.dst_ip}}\tdpt={{req.dst_port}}\trequest_time={{req.time}}\tresponse_time={{resp.time}}\turl={{req.raw_uri}}\tsev={{severity}}\treq_tree.headers.cookie={{req_tree.tree.headers.cookie}}\trequestMethod={{req.method}}\treq_tree.url.path={{req_tree.tree.url.path}}\tdstBytes={{req_tree.tree.headers["content-length"]}}\tsrcBytes={{resp_tree.tree.headers["content-length"]}}'
CEF format template:
'{{req.time.strftime("%b %d %H:%M:%S")}} localhost CEF:0|iBatyr WAF|1.0|{{req.obj_id}}|HTTP Transaction|{{severity}}|src={{req.src_ip}} scrPort={{req.src_port}} dst={{req.dst_ip}} dstPort={{req.dst_port}} request_time={{time}} response_time={{resp.time}} request={{req.raw_uri}} requestCookies={{req_tree.tree.headers.cookie}} requestMethod={{req.method}} file_path={{req_tree.tree.url.path}} in={{req_tree.tree.headers["content_length"]}} out={{resp_tree.tree.headers["content_length"]}}'
Below is a description of the parameters and possible field values for sending:
Mode:
ALL – Sends a log of all transactions.
BLOCKED – only the log of blocked transactions is sent.
Retraining interval – how often transactions will be sampled from the database and sent to SIEM.
Address:
tcp://siem_ip:514 – sending via TCP connection;
udp://siem_ip:514 – sending via UDP connection;
file:///dev/log – writes a log to the local file system on the WAF node.
Acceptable placeholders:
time - transaction timestamp;
host_ip - address of the host from which the log is sent;
severity – severity of the event;
req – request data:
obj_id – transaction identifier on WAF;
src_ip – request source address;
src_port – request source port;
dst_ip – request destination address;
dst_port – request destination port;
time – request timestamp;
raw_uri – address of the requested page;
method – HTTP method;
protocol – transmission protocol.
resp – response data:
time – timestamp of the response.
req_tree – data about the parsed query tree:
tree:
time – request timestamp;
src_ip – request source address;
src_port – request source port;
dst_ip – request destination address;
dst_port – request destination port;
protocol – transmission protocol;
method – HTTP method;
url – address of the requested page;
headers – headers.
Cookie – Cookie header.
… – other headings.
resp_tree – data about the parsed response tree (by default, response tree parsing is disabled):
tree:
time – time stamp of the response;
src_port – request source port;
dst_ip – request destination address;
dst_port – request destination port;
protocol – transmission protocol;
method – HTTP method;
url – address of the requested page;
headers – response headers.
Cookie:
req_decision – WAF decision (pass/block):
decision – decision on the request;
rule – the rule triggered on the request:
name – name of the rule;
obj_id – rule identifier.
resp_decision – the rule triggered on the response:
decision – decision on the answer;
rule – the rule triggered on the response:
name – name of the rule;
obj_id – rule identifier.
webapp_id – identifier of the protected application on the WAF;
webapp_name – application name;
action_id – action identifier of the positive business logic model (for details, see the operator’s manual);
action_name – action name of the business logic model;
action_parameters – action parameters of the business logic model;
request_session_id – request session identifier;
response_session_id – response session identifier.
Since Jinja is used as templates, it is possible to write expressions of the following type in the templates.
Sample:
block_rule_name={{req_decision.rule_name if req_decision.decision ==
"BLOCK" else resp_decision.rule_name}}
Result:
block_rule_name=Name of the request blocking rule (if the reason was blocking the request), or the response (if the reason was blocking the response)
Sample:
{% for rule in req_decision.reason.matching_rules %}
rule={{rule.name}} {% endfor %}
Result:
rule=Parameter does not match the model rule=Inject javascript code into pages rule=Other signatures
