blob: 36e174eb8934f5a55b6ed130f564fa639cff327c [file] [log] [blame]
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +02001 -----------------------------------------------
2 Stream Processing Offload Engine (SPOE)
Christopher Faulet57583e42017-09-04 15:41:09 +02003 Version 1.2
4 ( Last update: 2017-09-22 )
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +02005 -----------------------------------------------
6 Author : Christopher Faulet
7 Contact : cfaulet at haproxy dot com
8
9
10SUMMARY
11--------
12
13 0. Terms
14 1. Introduction
15 2. SPOE configuration
16 2.1. SPOE scope
17 2.2. "spoe-agent" section
18 2.3. "spoe-message" section
Christopher Faulet11610f32017-09-21 10:23:10 +020019 2.4. "spoe-group" section
20 2.5. Example
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +020021 3. SPOP specification
22 3.1. Data types
23 3.2. Frames
24 3.2.1. Frame capabilities
25 3.2.2. Frame types overview
26 3.2.3. Workflow
27 3.2.4. Frame: HAPROXY-HELLO
28 3.2.5. Frame: AGENT-HELLO
29 3.2.6. Frame: NOTIFY
30 3.2.7. Frame: ACK
31 3.2.8. Frame: HAPROXY-DISCONNECT
32 3.2.9. Frame: AGENT-DISCONNECT
33 3.3. Events & messages
34 3.4. Actions
Christopher Fauletd1307ce2017-02-27 21:59:39 +010035 3.5. Errors & timeouts
Christopher Fauletb2dd1e02018-03-22 09:07:41 +010036 4. Logging
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +020037
38
390. Terms
40---------
41
42* SPOE : Stream Processing Offload Engine.
43
44 A SPOE is a filter talking to servers managed ba a SPOA to offload the
45 stream processing. An engine is attached to a proxy. A proxy can have
Christopher Fauletd1307ce2017-02-27 21:59:39 +010046 several engines. Each engine is linked to an agent and only one.
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +020047
48* SPOA : Stream Processing Offload Agent.
49
50 A SPOA is a service that will receive info from a SPOE to offload the
51 stream processing. An agent manages several servers. It uses a backend to
52 reference all of them. By extension, these servers can also be called
53 agents.
54
55* SPOP : Stream Processing Offload Protocol, used by SPOEs to talk to SPOA
56 servers.
57
58 This protocol is used by engines to talk to agents. It is an in-house
59 binary protocol described in this documentation.
60
61
621. Introduction
63----------------
64
65SPOE is a feature introduced in HAProxy 1.7. It makes possible the
66communication with external components to retrieve some info. The idea started
67with the problems caused by most ldap libs not working fine in event-driven
68systems (often at least the connect() is blocking). So, it is hard to properly
69implement Single Sign On solution (SSO) in HAProxy. The SPOE will ease this
70kind of processing, or we hope so.
71
72Now, the aim of SPOE is to allow any kind of offloading on the streams. First
73releases, besides being experimental, won't do lot of things. As we will see,
74there are few handled events and even less actions supported. Actually, for
75now, the SPOE can offload the processing before "tcp-request content",
76"tcp-response content", "http-request" and "http-response" rules. And it only
77supports variables definition. But, in spite of these limited features, we can
78easily imagine to implement SSO solution, ip reputation or ip geolocation
79services.
80
81
822. SPOE configuration
83----------------------
84
85Because SPOE is implemented as a filter, To use it, you must declare a "filter
86spoe" line in a proxy section (frontend/backend/listen) :
87
88 frontend my-front
89 ...
90 filter spoe [engine <name>] config <file>
91 ...
92
93The "config" parameter is mandatory. It specififies the SPOE configuration
94file. The engine name is optional. It can be set to declare the scope to use in
95the SPOE configuration. So it is possible to use the same SPOE configuration
96for several engines. If no name is provided, the SPOE configuration must not
97contain any scope directive.
98
99We use a separate configuration file on purpose. By commenting SPOE filter
100line, you completly disable the feature, including the parsing of sections
101reserved to SPOE. This is also a way to keep the HAProxy configuration clean.
102
103A SPOE configuration file must contains, at least, the SPOA configuration
Christopher Faulet11610f32017-09-21 10:23:10 +0200104("spoe-agent" section) and SPOE messages/groups ("spoe-message" or "spoe-group"
105sections) attached to this agent.
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200106
107IMPORTANT : The configuration of a SPOE filter must be located in a dedicated
108file. But the backend used by a SPOA must be declared in HAProxy configuration
109file.
110
1112.1. SPOE scope
112-------------------------
113
114If you specify an engine name on the SPOE filter line, then you need to define
115scope in the SPOE configuration with the same name. You can have several SPOE
116scope in the same file. In each scope, you must define one and only one
117"spoe-agent" section to configure the SPOA linked to your SPOE and several
Christopher Faulet11610f32017-09-21 10:23:10 +0200118"spoe-message" and "spoe-group" sections to describe, respecively, messages and
119group of messages sent to servers mananged by your SPOA.
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200120
121A SPOE scope starts with this kind of line :
122
123 [<name>]
124
125where <name> is the same engine name specified on the SPOE filter line. The
126scope ends when the file ends or when another scope is found.
127
128 Example :
129 [my-first-engine]
130 spoe-agent my-agent
131 ...
132 spoe-message msg1
133 ...
134 spoe-message msg2
135 ...
Christopher Fauletb2dd1e02018-03-22 09:07:41 +0100136 spoe-group grp1
Christopher Faulet11610f32017-09-21 10:23:10 +0200137 ...
Christopher Fauletb2dd1e02018-03-22 09:07:41 +0100138 spoe-group grp2
139 ...
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200140
141 [my-second-engine]
142 ...
143
144If no engine name is provided on the SPOE filter line, no SPOE scope must be
145found in the SPOE configuration file. All the file is considered to be in the
146same anonymous and implicit scope.
147
Christopher Faulet7ee86672017-09-19 11:08:28 +0200148The engine name must be uniq for a proxy. If no engine name is provided on the
149SPOE filter line, the SPOE agent name is unsed by default.
150
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +02001512.2. "spoe-agent" section
152--------------------------
153
154For each engine, you must define one and only one "spoe-agent" section. In this
155section, you will declare SPOE messages and the backend you will use. You will
156also set timeouts and options to customize your agent's behaviour.
157
158
159spoe-agent <name>
160 Create a new SPOA with the name <name>. It must have one and only one
161 "spoe-agent" definition by SPOE scope.
162
163 Arguments :
164 <name> is the name of the agent section.
165
166 following keywords are supported :
Christopher Faulet11610f32017-09-21 10:23:10 +0200167 - groups
Christopher Faulet7250b8f2018-03-26 17:19:01 +0200168 - log
Christopher Faulet48026722016-11-16 15:01:12 +0100169 - maxconnrate
170 - maxerrrate
Christopher Fauletd1307ce2017-02-27 21:59:39 +0100171 - max-frame-size
Christopher Faulete8ade382018-01-25 15:32:22 +0100172 - max-waiting-frames
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200173 - messages
Christopher Fauletd1307ce2017-02-27 21:59:39 +0100174 - [no] option async
175 - [no] option pipelining
176 - [no] option send-frag-payload
Christopher Fauletea62c2a2016-11-14 10:54:21 +0100177 - option continue-on-error
Christopher Faulet336d3ef2017-12-22 10:00:55 +0100178 - option force-set-var
Christopher Faulet985532d2016-11-16 15:36:19 +0100179 - option set-on-error
Christopher Faulet36bda1c2018-03-22 09:08:20 +0100180 - option set-process-time
181 - option set-total-time
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200182 - option var-prefix
Christopher Faulet336d3ef2017-12-22 10:00:55 +0100183 - register-var-names
Christopher Faulet03a34492016-11-19 16:47:56 +0100184 - timeout hello|idle|processing
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200185 - use-backend
186
187
Christopher Faulet11610f32017-09-21 10:23:10 +0200188groups <grp-name> ...
189 Declare the list of SPOE groups that an agent will handle.
190
191 Arguments :
192 <grp-name> is the name of a SPOE group.
193
194 Groups delcared here must be found in the same engine scope, else an error is
195 triggered during the configuration parsing. You can have many "groups" lines.
196
197 See also: "spoe-group" section.
198
199
Christopher Faulet7250b8f2018-03-26 17:19:01 +0200200log global
201log <address> [len <length>] [format <format>] <facility> [<level> [<minlevel>]]
202no log
203 Enable per-instance logging of events and traffic.
204
205 Prefix :
206 no should be used when the logger list must be flushed.
207
208 See the HAProxy Configuration Manual for details about this option.
209
Christopher Faulet48026722016-11-16 15:01:12 +0100210maxconnrate <number>
211 Set the maximum number of connections per second to <number>. The SPOE will
212 stop to open new connections if the maximum is reached and will wait to
213 acquire an existing one. So it is important to set "timeout hello" to a
214 relatively small value.
215
216
217maxerrrate <number>
218 Set the maximum number of errors per second to <number>. The SPOE will stop
219 its processing if the maximum is reached.
220
221
Christopher Fauletd1307ce2017-02-27 21:59:39 +0100222max-frame-size <number>
223 Set the maximum allowed size for frames exchanged between HAProxy and SPOA.
224 It must be in the range [256, tune.bufsize-4] (4 bytes are reserved for the
225 frame length). By default, it is set to (tune.bufsize-4).
226
Christopher Faulete8ade382018-01-25 15:32:22 +0100227max-waiting-frames <number>
228 Set the maximum number of frames waiting for an acknowledgement on the same
229 connection. This value is only used when the pipelinied or asynchronus
230 exchanges between HAProxy and SPOA are enabled. By default, it is set to 20.
Christopher Fauletd1307ce2017-02-27 21:59:39 +0100231
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200232messages <msg-name> ...
233 Declare the list of SPOE messages that an agent will handle.
234
235 Arguments :
236 <msg-name> is the name of a SPOE message.
237
238 Messages declared here must be found in the same engine scope, else an error
239 is triggered during the configuration parsing. You can have many "messages"
240 lines.
241
242 See also: "spoe-message" section.
243
244
Christopher Fauletd1307ce2017-02-27 21:59:39 +0100245option async
246no option async
247 Enable or disable the support of asynchronus exchanges between HAProxy and
248 SPOA. By default, this option is enabled.
249
250
Christopher Fauletea62c2a2016-11-14 10:54:21 +0100251option continue-on-error
252 Do not stop the events processing when an error occurred on a stream.
253
254 By default, for a specific stream, when an abnormal/unexpected error occurs,
255 the SPOE is disabled for all the transaction. So if you have several events
256 configured, such error on an event will disabled all followings. For TCP
257 streams, this will disable the SPOE for the whole session. For HTTP streams,
258 this will disable it for the transaction (request and response).
259
260 When set, this option bypass this behaviour and only the current event will
261 be ignored.
262
Etienne Carriereaec89892017-12-14 09:36:40 +0000263option force-set-var
264 By default, SPOE filter only register already known variables (mainly from
265 parsing of the configuration). If you want that haproxy trusts the agent and
266 registers all variables (ex: can be useful for LUA workload), activate this
267 option.
268
269 Caution : this option opens to a variety of attacks such as a rogue SPOA that
270 asks to register too many variables.
271
Christopher Fauletea62c2a2016-11-14 10:54:21 +0100272
Christopher Fauletd1307ce2017-02-27 21:59:39 +0100273option pipelining
274no option pipelining
275 Enable or disable the support of pipelined exchanges between HAProxy and
276 SPOA. By default, this option is enabled.
277
278
279option send-frag-payload
280no option send-frag-payload
281 Enable or disable the sending of fragmented payload to SPOA. By default, this
282 option is enabled.
283
284
Christopher Faulet985532d2016-11-16 15:36:19 +0100285option set-on-error <var name>
286 Define the variable to set when an error occurred during an event processing.
287
288 Arguments :
289
290 <var name> is the variable name, without the scope. The name may only
291 contain characters 'a-z', 'A-Z', '0-9', '.' and '_'.
292
293 This variable will only be set when an error occurred in the scope of the
294 transaction. As for all other variables define by the SPOE, it will be
295 prefixed. So, if your variable name is "error" and your prefix is
296 "my_spoe_pfx", the variable will be "txn.my_spoe_pfx.error".
297
Christopher Fauletb067b062017-01-04 16:39:11 +0100298 When set, the variable is an integer representing the error reason. For values
299 under 256, it represents an error coming from the engine. Below 256, it
300 reports a SPOP error. In this case, to retrieve the right SPOP status code,
301 you must remove 256 to this value. Here are possible values:
302
303 * 1 a timeout occurred during the event processing.
304
305 * 2 an error was triggered during the ressources allocation.
306
Christopher Fauletd1307ce2017-02-27 21:59:39 +0100307 * 3 the frame payload exceeds the frame size and it cannot be
308 fragmented.
309
310 * 4 the fragmentation of a payload is aborted.
311
Christopher Faulet344c4ab2017-09-22 10:20:13 +0200312 * 5 The frame processing has been interrupted by HAProxy.
313
Christopher Fauletb067b062017-01-04 16:39:11 +0100314 * 255 an unknown error occurred during the event processing.
315
316 * 256+N a SPOP error occurred during the event processing (see section
317 "Errors & timeouts").
318
319 Note that if "option continue-on-error" is set, the variable is not
320 automatically removed between events processing.
Christopher Faulet985532d2016-11-16 15:36:19 +0100321
322 See also: "option continue-on-error", "option var-prefix".
323
Christopher Faulet36bda1c2018-03-22 09:08:20 +0100324
325option set-process-time <var name>
326 Define the variable to set to report the processing time of the last event or
327 group.
328
329 Arguments :
330
331 <var name> is the variable name, without the scope. The name may only
332 contain characters 'a-z', 'A-Z', '0-9', '.' and '_'.
333
334 This variable will be set in the scope of the transaction. As for all other
335 variables define by the SPOE, it will be prefixed. So, if your variable name
336 is "process_time" and your prefix is "my_spoe_pfx", the variable will be
337 "txn.my_spoe_pfx.process_time".
338
339 When set, the variable is an integer representing the delay to process the
340 event or the group, in milliseconds. From the stream point of view, it is the
341 latency added by the SPOE processing for the last handled event or group.
342
343 If several events or groups are processed for the same stream, this value
344 will be overrideen.
345
346 See also: "option set-total-time".
347
348
349option set-total-time <var name>
350 Define the variable to set to report the total processing time SPOE for a
351 stream.
352
353 Arguments :
354
355 <var name> is the variable name, without the scope. The name may only
356 contain characters 'a-z', 'A-Z', '0-9', '.' and '_'.
357
358 This variable will be set in the scope of the transaction. As for all other
359 variables define by the SPOE, it will be prefixed. So, if your variable name
360 is "total_time" and your prefix is "my_spoe_pfx", the variable will be
361 "txn.my_spoe_pfx.total_time".
362
363 When set, the variable is an integer representing the sum of processing times
364 for a stream, in milliseconds. From the stream point of view, it is the
365 latency added by the SPOE processing.
366
367 If several events or groups are processed for the same stream, this value
368 will be updated.
369
370 See also: "option set-process-time".
371
372
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200373option var-prefix <prefix>
374 Define the prefix used when variables are set by an agent.
375
376 Arguments :
377
378 <prefix> is the prefix used to limit the scope of variables set by an
379 agent.
380
381 To avoid conflict with other variables defined by HAProxy, all variables
382 names will be prefixed. By default, the "spoe-agent" name is used. This
383 option can be used to customize it.
384
385 The prefix will be added between the variable scope and its name, separated
386 by a '.'. It may only contain characters 'a-z', 'A-Z', '0-9', '.' and '_', as
387 for variables name. In HAProxy configuration, you need to use this prefix as
388 a part of the variables name. For example, if an agent define the variable
389 "myvar" in the "txn" scope, with the prefix "my_spoe_pfx", then you should
390 use "txn.my_spoe_pfx.myvar" name in your HAProxy configuration.
391
Etienne Carriereaec89892017-12-14 09:36:40 +0000392 By default, an agent will never set new variables at runtime: It can only set
393 new value for existing ones. If you want a different behaviour, see
Christopher Faulet336d3ef2017-12-22 10:00:55 +0100394 force-set-var option and register-var-names directive.
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200395
Christopher Faulet336d3ef2017-12-22 10:00:55 +0100396register-var-names <var name> ...
397 Register some variable names. By default, an agent will not be allowed to set
398 new variables at runtime. This rule can be totally relaxed by setting the
399 option "force-set-var". If you know all the variables you will need, this
400 directive is a good way to register them without letting an agent doing what
401 it want. This is only required if these variables are not referenced anywhere
402 in the HAProxy configuration or the SPOE one.
403
404 Arguments:
405 <var name> is a variable name without the scope. The name may only
406 contain characters 'a-z', 'A-Z', '0-9', '.' and '_'.
407
408 The prefix will be automatically added during the registration. You can have
409 many "register-var-names" lines.
410
411 See also: "option force-set-var", "option var-prefix".
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200412
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200413timeout hello <timeout>
414 Set the maximum time to wait for an agent to receive the AGENT-HELLO frame.
Christopher Fauletf7a30922016-11-10 15:04:51 +0100415 It is applied on the stream that handle the connection with the agent.
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200416
417 Arguments :
418 <timeout> is the timeout value specified in milliseconds by default, but
419 can be in any other unit if the number is suffixed by the unit,
420 as explained at the top of this document.
421
422 This timeout is an applicative timeout. It differ from "timeout connect"
423 defined on backends.
424
425
426timeout idle <timeout>
Christopher Fauletf7a30922016-11-10 15:04:51 +0100427 Set the maximum time to wait for an agent to close an idle connection. It is
428 applied on the stream that handle the connection with the agent.
429
430 Arguments :
431 <timeout> is the timeout value specified in milliseconds by default, but
432 can be in any other unit if the number is suffixed by the unit,
433 as explained at the top of this document.
434
435
436timeout processing <timeout>
437 Set the maximum time to wait for a stream to process an event, i.e to acquire
438 a stream to talk with an agent, to encode all messages, to send the NOTIFY
439 frame, to receive the corrsponding acknowledgement and to process all
440 actions. It is applied on the stream that handle the client and the server
441 sessions.
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200442
443 Arguments :
444 <timeout> is the timeout value specified in milliseconds by default, but
445 can be in any other unit if the number is suffixed by the unit,
446 as explained at the top of this document.
447
448
449use-backend <backend>
450 Specify the backend to use. It must be defined.
451
452 Arguments :
453 <backend> is the name of a valid "backend" section.
454
455
4562.3. "spoe-message" section
457----------------------------
458
459To offload the stream processing, SPOE will send messages with specific
460information at a specific moment in the stream life and will wait for
461corresponding replies to know what to do.
462
463
464spoe-message <name>
465 Create a new SPOE message with the name <name>.
466
467 Arguments :
468 <name> is the name of the SPOE message.
469
470 Here you define a message that can be referenced in a "spoe-agent"
471 section. Following keywords are supported :
Christopher Faulet57583e42017-09-04 15:41:09 +0200472 - acl
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200473 - args
474 - event
475
476 See also: "spoe-agent" section.
477
478
Christopher Faulet57583e42017-09-04 15:41:09 +0200479acl <aclname> <criterion> [flags] [operator] <value> ...
Christopher Faulet57583e42017-09-04 15:41:09 +0200480 Declare or complete an access list.
481
482 See section 7 about ACL usage in the HAProxy Configuration Manual.
483
484
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200485args [name=]<sample> ...
486 Define arguments passed into the SPOE message.
487
488 Arguments :
489 <sample> is a sample expression.
490
491 When the message is processed, if a sample expression is not available, it is
492 set to NULL. Arguments are processed in their declaration order and added in
493 the message in that order. It is possible to declare named arguements.
494
495 For example:
496 args frontend=fe_id src dst
497
498
Christopher Faulet57583e42017-09-04 15:41:09 +0200499event <name> [ { if | unless } <condition> ]
500 Set the event that triggers sending of the message. It may optionally be
501 followed by an ACL-based condition, in which case it will only be evaluated
502 if the condition is true.
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200503
Christopher Faulet57583e42017-09-04 15:41:09 +0200504 ACL-based conditions are executed in the context of the stream that handle
505 the client and the server connections.
506
507 Arguments :
508 <name> is the event name.
509 <condition> is a standard ACL-based condition.
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200510
511 Supported events are:
512 - on-client-session
Christopher Faulet1002aac2016-12-09 17:41:54 +0100513 - on-server-session
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200514 - on-frontend-tcp-request
515 - on-backend-tcp-request
516 - on-tcp-response
517 - on-frontend-http-request
518 - on-backend-http-request
519 - on-http-response
520
Christopher Faulet57583e42017-09-04 15:41:09 +0200521 See section "Events & Messages" for more details about supported events.
522 See section 7 about ACL usage in the HAProxy Configuration Manual.
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200523
Christopher Faulet11610f32017-09-21 10:23:10 +02005242.4. "spoe-group" section
525--------------------------
526
527This section can be used to declare a group of SPOE messages. Unlike messages
528referenced in a "spoe-agent" section, messages inside a group are not sent on a
529specific event. The sending must be triggered by TCP or HTTP rules, from the
530HAProxy configuration.
531
532
533spoe-group <name>
534 Create a new SPOE group with the name <name>.
535
536 Arguments :
537 <name> is the name of the SPOE group.
538
539 Here you define a group of SPOE messages that can be referenced in a
540 "spoe-agent" section. Following keywords are supported :
541 - messages
542
543 See also: "spoe-agent" and "spoe-message" sections.
544
545
546messages <msg-name> ...
547 Declare the list of SPOE messages belonging to the group.
548
549 Arguments :
550 <msg-name> is the name of a SPOE message.
551
552 Messages declared here must be found in the same engine scope, else an error
553 is triggered during the configuration parsing. Furthermore, a message belongs
554 at most to a group. You can have many "messages" lines.
555
556 See also: "spoe-message" section.
557
558
5592.5. Example
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200560-------------
561
562Here is a simple but complete example that sends client-ip address to a ip
563reputation service. This service can set the variable "ip_score" which is an
564integer between 0 and 100, indicating its reputation (100 means totally safe
565and 0 a blacklisted IP with no doubt).
566
567 ###
568 ### HAProxy configuration
569 frontend www
570 mode http
571 bind *:80
572
573 filter spoe engine ip-reputation config spoe-ip-reputation.conf
574
575 # Reject connection if the IP reputation is under 20
576 tcp-request content reject if { var(sess.iprep.ip_score) -m int lt 20 }
577
578 default_backend http-servers
579
580 backend http-servers
581 mode http
582 server http A.B.C.D:80
583
584 backend iprep-servers
585 mode tcp
586 balance roundrobin
587
588 timeout connect 5s # greater than hello timeout
589 timeout server 3m # greater than idle timeout
590
591 server iprep1 A1.B1.C1.D1:12345
592 server iprep2 A2.B2.C2.D2:12345
593
594 ####
595 ### spoe-ip-reputation.conf
596 [ip-reputation]
597
598 spoe-agent iprep-agent
599 messages get-ip-reputation
600
601 option var-prefix iprep
602
Christopher Faulet03a34492016-11-19 16:47:56 +0100603 timeout hello 2s
604 timeout idle 2m
605 timeout processing 10ms
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200606
607 use-backend iprep-servers
608
609 spoe-message get-ip-reputation
610 args ip=src
Christopher Faulet57583e42017-09-04 15:41:09 +0200611 event on-client-session if ! { src -f /etc/haproxy/whitelist.lst }
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200612
613
6143. SPOP specification
615----------------------
616
6173.1. Data types
618----------------
619
620Here is the bytewise representation of typed data:
621
622 TYPED-DATA : <TYPE:4 bits><FLAGS:4 bits><DATA>
623
624Supported types and their representation are:
625
626 TYPE | ID | DESCRIPTION
627 -----------------------------+-----+----------------------------------
628 NULL | 0 | NULL : <0>
629 Boolean | 1 | BOOL : <1+FLAG>
630 32bits signed integer | 2 | INT32 : <2><VALUE:varint>
631 32bits unsigned integer | 3 | UINT32 : <3><VALUE:varint>
632 64bits signed integer | 4 | INT64 : <4><VALUE:varint>
633 32bits unsigned integer | 5 | UNIT64 : <5><VALUE:varint>
634 IPV4 | 6 | IPV4 : <6><STRUCT IN_ADDR:4 bytes>
635 IPV6 | 7 | IPV6 : <7><STRUCT IN_ADDR6:16 bytes>
636 String | 8 | STRING : <8><LENGTH:varint><BYTES>
637 Binary | 9 | BINARY : <9><LENGTH:varint><BYTES>
638 10 -> 15 unused/reserved | - | -
639 -----------------------------+-----+----------------------------------
640
641Variable-length integer (varint) are encoded using Peers encoding:
642
643
644 0 <= X < 240 : 1 byte (7.875 bits) [ XXXX XXXX ]
645 240 <= X < 2288 : 2 bytes (11 bits) [ 1111 XXXX ] [ 0XXX XXXX ]
646 2288 <= X < 264432 : 3 bytes (18 bits) [ 1111 XXXX ] [ 1XXX XXXX ] [ 0XXX XXXX ]
647 264432 <= X < 33818864 : 4 bytes (25 bits) [ 1111 XXXX ] [ 1XXX XXXX ]*2 [ 0XXX XXXX ]
648 33818864 <= X < 4328786160 : 5 bytes (32 bits) [ 1111 XXXX ] [ 1XXX XXXX ]*3 [ 0XXX XXXX ]
649 ...
650
651For booleans, the value (true or false) is the first bit in the FLAGS
652bitfield. if this bit is set to 0, then the boolean is evaluated as false,
653otherwise, the boolean is evaluated as true.
654
6553.2. Frames
656------------
657
658Exchange between HAProxy and agents are made using FRAME packets. All frames
659must be prefixed with their size encoded on 4 bytes in network byte order:
660
661 <FRAME-LENGTH:4 bytes> <FRAME>
662
663A frame always starts with its type, on one byte, followed by metadata
664containing flags, on 4 bytes and a two variable-length integer representing the
665stream identifier and the frame identifier inside the stream:
666
667 FRAME : <FRAME-TYPE:1 byte> <METADATA> <FRAME-PAYLOAD>
668 METADATA : <FLAGS:4 bytes> <STREAM-ID:varint> <FRAME-ID:varint>
669
670Then comes the frame payload. Depending on the frame type, the payload can be
671of three types: a simple key/value list, a list of messages or a list of
672actions.
673
674 FRAME-PAYLOAD : <LIST-OF-MESSAGES> | <LIST-OF-ACTIONS> | <KV-LIST>
675
676 LIST-OF-MESSAGES : [ <MESSAGE-NAME> <NB-ARGS:1 byte> <KV-LIST> ... ]
677 MESSAGE-NAME : <STRING>
678
679 LIST-OF-ACTIONS : [ <ACTION-TYPE:1 byte> <NB-ARGS:1 byte> <ACTION-ARGS> ... ]
680 ACTION-ARGS : [ <TYPED-DATA>... ]
681
682 KV-LIST : [ <KV-NAME> <KV-VALUE> ... ]
683 KV-NAME : <STRING>
684 KV-VALUE : <TYPED-DATA>
685
Christopher Fauletd1307ce2017-02-27 21:59:39 +0100686 FLAGS : 0 1 2-31
687 +---+---+----------+
688 | | A | |
689 | F | B | |
690 | I | O | RESERVED |
691 | N | R | |
692 | | T | |
693 +---+---+----------+
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200694
695 FIN: Indicates that this is the final payload fragment. The first fragment
696 may also be the final fragment.
697
Christopher Fauletd1307ce2017-02-27 21:59:39 +0100698 ABORT: Indicates that the processing of the current frame must be
699 cancelled. This bit should be set on frames with a fragmented
700 payload. It can be ignore for frames with an unfragemnted
701 payload. When it is set, the FIN bit must also be set.
702
703
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200704Frames cannot exceed a maximum size negociated between HAProxy and agents
705during the HELLO handshake. Most of time, payload will be small enough to send
706it in one frame. But when supported by the peer, it will be possible to
707fragment huge payload on many frames. This ability is announced during the
708HELLO handshake and it can be asynmetric (supported by agents but not by
709HAProxy or the opposite). The following rules apply to fragmentation:
710
711 * An unfragemnted payload consists of a single frame with the FIN bit set.
712
713 * A fragemented payload consists of several frames with the FIN bit clear and
714 terminated by a single frame with the FIN bit set. All these frames must
Christopher Fauletd1307ce2017-02-27 21:59:39 +0100715 share the same STREAM-ID and FRAME-ID. The first frame must set the right
716 FRAME-TYPE (e.g, NOTIFY). The following frames must have an unset type (0).
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200717
718Beside the support of fragmented payload by a peer, some payload must not be
719fragmented. See below for details.
720
Christopher Fauletd1307ce2017-02-27 21:59:39 +0100721IMPORTANT : The maximum size supported by peers for a frame must be greater
722than or equal to 256 bytes.
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200723
7243.2.1. Frame capabilities
725--------------------------
726
727Here are the list of official capabilities that HAProxy and agents can support:
728
Christopher Fauleta1cda022016-12-21 08:58:06 +0100729 * fragmentation: This is the ability for a peer to support fragmented
730 payload in received frames. This is an asymmectical
731 capability, it only concerns the peer that announces
732 it. This is the responsibility to the other peer to use it
733 or not.
734
735 * pipelining: This is the ability for a peer to decouple NOTIFY and ACK
736 frames. This is a symmectical capability. To be used, it must
737 be supported by HAproxy and agents. Unlike HTTP pipelining, the
738 ACK frames can be send in any order, but always on the same TCP
739 connection used for the corresponding NOTIFY frame.
740
741 * async: This ability is similar to the pipelining, but here any TCP
742 connection established between HAProxy and the agent can be used to
743 send ACK frames. if an agent accepts connections from multiple
744 HAProxy, it can use the "engine-id" value to group TCP
745 connections. See details about HAPROXY-HELLO frame.
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200746
747Unsupported or unknown capabilities are silently ignored, when possible.
748
7493.2.2. Frame types overview
750----------------------------
751
752Here are types of frame supported by SPOE. Frames sent by HAProxy come first,
753then frames sent by agents :
754
755 TYPE | ID | DESCRIPTION
756 -----------------------------+-----+-------------------------------------
Christopher Fauletd1307ce2017-02-27 21:59:39 +0100757 UNSET | 0 | Used for all frames but the first when a
758 | | payload is fragmented.
759 -----------------------------+-----+-------------------------------------
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200760 HAPROXY-HELLO | 1 | Sent by HAProxy when it opens a
761 | | connection on an agent.
762 | |
763 HAPROXY-DISCONNECT | 2 | Sent by HAProxy when it want to close
764 | | the connection or in reply to an
765 | | AGENT-DISCONNECT frame
766 | |
767 NOTIFY | 3 | Sent by HAProxy to pass information
768 | | to an agent
769 -----------------------------+-----+-------------------------------------
770 AGENT-HELLO | 101 | Reply to a HAPROXY-HELLO frame, when
771 | | the connection is established
772 | |
773 AGENT-DISCONNECT | 102 | Sent by an agent just before closing
774 | | the connection
775 | |
776 ACK | 103 | Sent to acknowledge a NOTIFY frame
777 -----------------------------+-----+-------------------------------------
778
779Unknown frames may be silently skipped.
780
7813.2.3. Workflow
782----------------
783
784 * Successful HELLO handshake:
785
786 HAPROXY AGENT SRV
787 | HAPROXY-HELLO |
Christopher Fauletba7bc162016-11-07 21:07:38 +0100788 | (healthcheck: false) |
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200789 | --------------------------> |
790 | |
791 | AGENT-HELLO |
792 | <-------------------------- |
793 | |
794
Christopher Fauletba7bc162016-11-07 21:07:38 +0100795 * Successful HELLO healthcheck:
796
797 HAPROXY AGENT SRV
798 | HAPROXY-HELLO |
799 | (healthcheck: true) |
800 | --------------------------> |
801 | |
802 | AGENT-HELLO + close() |
803 | <-------------------------- |
804 | |
805
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200806
807 * Error encountered by agent during the HELLO handshake:
808
809 HAPROXY AGENT SRV
810 | HAPROXY-HELLO |
811 | --------------------------> |
812 | |
813 | DISCONNECT + close() |
814 | <-------------------------- |
815 | |
816
817 * Error encountered by HAProxy during the HELLO handshake:
818
819 HAPROXY AGENT SRV
820 | HAPROXY-HELLO |
821 | --------------------------> |
822 | |
823 | AGENT-HELLO |
824 | <-------------------------- |
825 | |
826 | DISCONNECT |
827 | --------------------------> |
828 | |
829 | DISCONNECT + close() |
830 | <-------------------------- |
831 | |
832
Christopher Fauletd1307ce2017-02-27 21:59:39 +0100833 * Notify / Ack exchange (unfragmented payload):
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200834
835 HAPROXY AGENT SRV
836 | NOTIFY |
837 | --------------------------> |
838 | |
839 | ACK |
840 | <-------------------------- |
841 | |
842
Christopher Fauletd1307ce2017-02-27 21:59:39 +0100843 * Notify / Ack exchange (fragmented payload):
844
845 HAPROXY AGENT SRV
846 | NOTIFY (frag 1) |
847 | --------------------------> |
848 | |
849 | UNSET (frag 2) |
850 | --------------------------> |
851 | ... |
852 | UNSET (frag N) |
853 | --------------------------> |
854 | |
855 | ACK |
856 | <-------------------------- |
857 | |
858
859 * Aborted fragmentation of a NOTIFY frame:
860
861 HAPROXY AGENT SRV
862 | ... |
863 | UNSET (frag X) |
864 | --------------------------> |
865 | |
866 | ACK/ABORT |
867 | <-------------------------- |
868 | |
869 | UNSET (frag X+1) |
870 | -----------X |
871 | |
872 | |
873
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200874 * Connection closed by haproxy:
875
876 HAPROXY AGENT SRV
877 | DISCONNECT |
878 | --------------------------> |
879 | |
880 | DISCONNECT + close() |
881 | <-------------------------- |
882 | |
883
884 * Connection closed by agent:
885
886 HAPROXY AGENT SRV
887 | DISCONNECT + close() |
888 | <-------------------------- |
889 | |
890
8913.2.4. Frame: HAPROXY-HELLO
892----------------------------
893
894This frame is the first one exchanged between HAProxy and an agent, when the
895connection is established. The payload of this frame is a KV-LIST. It cannot be
896fragmented. STREAM-ID and FRAME-ID are must be set 0.
897
898Following items are mandatory in the KV-LIST:
899
900 * "supported-versions" <STRING>
901
902 Last SPOP major versions supported by HAProxy. It is a comma-separated list
903 of versions, following the format "Major.Minor". Spaces must be ignored, if
904 any. When a major version is announced by HAProxy, it means it also support
905 all previous minor versions.
906
907 Example: "2.0, 1.5" means HAProxy supports SPOP 2.0 and 1.0 to 1.5
908
909 * "max-frame-size" <UINT32>
910
911 This is the maximum size allowed for a frame. The HAPROXY-HELLO frame must
912 be lower or equal to this value.
913
914 * "capabilities" <STRING>
915
916 This a comma-separated list of capabilities supported by HAProxy. Spaces
917 must be ignored, if any.
918
Christopher Fauletba7bc162016-11-07 21:07:38 +0100919Following optional items can be added in the KV-LIST:
920
921 * "healthcheck" <BOOLEAN>
922
923 If this item is set to TRUE, then the HAPROXY-HELLO frame is sent during a
924 SPOE health check. When set to FALSE, this item can be ignored.
925
Christopher Fauleta1cda022016-12-21 08:58:06 +0100926 * "engine-id" <STRING>
927
928 This is a uniq string that identify a SPOE engine.
929
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200930To finish the HELLO handshake, the agent must return an AGENT-HELLO frame with
931its supported SPOP version, the lower value between its maximum size allowed
932for a frame and the HAProxy one and capabilities it supports. If an error
933occurs or if an incompatibility is detected with the agent configuration, an
934AGENT-DISCONNECT frame must be returned.
935
9363.2.5. Frame: AGENT-HELLO
937--------------------------
938
939This frame is sent in reply to a HAPROXY-HELLO frame to finish a HELLO
940handshake. As for HAPROXY-HELLO frame, STREAM-ID and FRAME-ID are also set
9410. The payload of this frame is a KV-LIST and it cannot be fragmented.
942
943Following items are mandatory in the KV-LIST:
944
945 * "version" <STRING>
946
947 This is the SPOP version the agent supports. It must follow the format
948 "Major.Minor" and it must be lower or equal than one of major versions
949 announced by HAProxy.
950
951 * "max-frame-size" <UINT32>
952
953 This is the maximum size allowed for a frame. It must be lower or equal to
954 the value in the HAPROXY-HELLO frame. This value will be used for all
955 subsequent frames.
956
957 * "capabilities" <STRING>
958
959 This a comma-separated list of capabilities supported by agent. Spaces must
960 be ignored, if any.
961
962At this time, if everything is ok for HAProxy (supported version and valid
963max-frame-size value), the HELLO handshake is successfully completed. Else,
964HAProxy sends a HAPROXY-DISCONNECT frame with the corresponding error.
965
Christopher Fauletba7bc162016-11-07 21:07:38 +0100966If "healthcheck" item was set to TRUE in the HAPROXY-HELLO frame, the agent can
967safely close the connection without DISCONNECT frame. In all cases, HAProxy
968will close the connexion at the end of the health check.
969
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +02009703.2.6. Frame: NOTIFY
971---------------------
972
973Information are sent to the agents inside NOTIFY frames. These frames are
974attached to a stream, so STREAM-ID and FRAME-ID must be set. The payload of
975NOTIFY frames is a LIST-OF-MESSAGES and, if supported by agents, it can be
976fragmented.
977
978NOTIFY frames must be acknowledge by agents sending an ACK frame, repeating
979right STREAM-ID and FRAME-ID.
980
9813.2.7. Frame: ACK
982------------------
983
984ACK frames must be sent by agents to reply to NOTIFY frames. STREAM-ID and
985FRAME-ID found in a NOTIFY frame must be reuse in the corresponding ACK
986frame. The payload of ACK frames is a LIST-OF-ACTIONS and, if supported by
987HAProxy, it can be fragmented.
988
9893.2.8. Frame: HAPROXY-DISCONNECT
990---------------------------------
991
992If an error occurs, at anytime, from the HAProxy side, a HAPROXY-DISCONNECT
993frame is sent with information describing the error. HAProxy will wait an
994AGENT-DISCONNECT frame in reply. All other frames will be ignored. The agent
995must then close the socket.
996
997The payload of this frame is a KV-LIST. It cannot be fragmented. STREAM-ID and
998FRAME-ID are must be set 0.
999
1000Following items are mandatory in the KV-LIST:
1001
1002 * "status-code" <UINT32>
1003
1004 This is the code corresponding to the error.
1005
1006 * "message" <STRING>
1007
1008 This is a textual message describing the error.
1009
1010For more information about known errors, see section "Errors & timeouts"
1011
10123.2.9. Frame: AGENT-DISCONNECT
1013-------------------------------
1014
1015If an error occurs, at anytime, from the agent size, a AGENT-DISCONNECT frame
1016is sent, with information desribing the error. such frame is also sent in reply
1017to a HAPROXY-DISCONNECT. The agent must close the socket just after sending
1018this frame.
1019
1020The payload of this frame is a KV-LIST. It cannot be fragmented. STREAM-ID and
1021FRAME-ID are must be set 0.
1022
1023Following items are mandatory in the KV-LIST:
1024
1025 * "status-code" <UINT32>
1026
1027 This is the code corresponding to the error.
1028
1029 * "message" <STRING>
1030
1031 This is a textual message describing the error.
1032
1033For more information about known errors, see section "Errors & timeouts"
1034
10353.3. Events & Messages
1036-----------------------
1037
1038Information about streams are sent in NOTIFY frames. You can specify which kind
1039of information to send by defining "spoe-message" sections in your SPOE
1040configuration file. for each "spoe-message" there will be a message in a NOTIFY
1041frame when the right event is triggered.
1042
1043A NOTIFY frame is sent for an specific event when there is at least one
1044"spoe-message" attached to this event. All messages for an event will be added
1045in the same NOTIFY frame.
1046
1047Here is the list of supported events:
1048
1049 * on-client-session is triggered when a new client session is created.
1050 This event is only available for SPOE filters
1051 declared in a frontend or a listen section.
1052
1053 * on-frontend-tcp-request is triggered just before the evaluation of
1054 "tcp-request content" rules on the frontend side.
1055 This event is only available for SPOE filters
1056 declared in a frontend or a listen section.
1057
1058 * on-backend-tcp-request is triggered just before the evaluation of
1059 "tcp-request content" rules on the backend side.
1060 This event is skipped for SPOE filters declared
1061 in a listen section.
1062
1063 * on-frontend-http-request is triggered just before the evaluation of
1064 "http-request" rules on the frontend side. This
1065 event is only available for SPOE filters declared
1066 in a frontend or a listen section.
1067
1068 * on-backend-http-request is triggered just before the evaluation of
1069 "http-request" rules on the backend side. This
1070 event is skipped for SPOE filters declared in a
1071 listen section.
1072
1073 * on-server-session is triggered when the session with the server is
1074 established.
1075
1076 * on-tcp-response is triggered just before the evaluation of
1077 "tcp-response content" rules.
1078
1079 * on-http-response is triggered just before the evaluation of
1080 "http-response" rules.
1081
1082
1083The stream processing will loop on these events, when triggered, waiting the
1084agent reply.
1085
10863.4. Actions
1087-------------
1088
1089An agent must acknowledge each NOTIFY frame by sending the corresponding ACK
1090frame. Actions can be added in these frames to dynamically take action on the
1091processing of a stream.
1092
1093Here is the list of supported actions:
1094
1095 * set-var set the value for an existing variable. 3 arguments must be
1096 attached to this action: the variable scope (proc, sess, txn,
1097 req or req), the variable name (a string) and its value.
1098
1099 ACTION-SET-VAR : <SET-VAR:1 byte><NB-ARGS:1 byte><VAR-SCOPE:1 byte><VAR-NAME><VAR-VALUE>
1100
1101 SET-VAR : <1>
1102 NB-ARGS : <3>
1103 VAR-SCOPE : <PROCESS> | <SESSION> | <TRANSACTION> | <REQUEST> | <RESPONSE>
1104 VAR-NAME : <STRING>
1105 VAR-VALUE : <TYPED-DATA>
1106
1107 PROCESS : <0>
1108 SESSION : <1>
1109 TRANSACTION : <2>
1110 REQUEST : <3>
Christopher Fauleta1cda022016-12-21 08:58:06 +01001111 RESPONSE : <4>
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +02001112
1113 * unset-var unset the value for an existing variable. 2 arguments must be
1114 attached to this action: the variable scope (proc, sess, txn,
1115 req or req) and the variable name (a string).
1116
Christopher Faulet1002aac2016-12-09 17:41:54 +01001117 ACTION-UNSET-VAR : <UNSET-VAR:1 byte><NB-ARGS:1 byte><VAR-SCOPE:1 byte><VAR-NAME>
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +02001118
Christopher Faulet1002aac2016-12-09 17:41:54 +01001119 UNSET-VAR : <2>
1120 NB-ARGS : <2>
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +02001121 VAR-SCOPE : <PROCESS> | <SESSION> | <TRANSACTION> | <REQUEST> | <RESPONSE>
1122 VAR-NAME : <STRING>
1123
1124 PROCESS : <0>
1125 SESSION : <1>
1126 TRANSACTION : <2>
1127 REQUEST : <3>
Christopher Fauleta1cda022016-12-21 08:58:06 +01001128 RESPONSE : <4>
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +02001129
1130
1131NOTE: Name of the variables will be automatically prefixed by HAProxy to avoid
1132 name clashes with other variables used in HAProxy. Moreover, unknown
1133 variable will be silently ignored.
1134
Christopher Fauletd1307ce2017-02-27 21:59:39 +010011353.5. Errors & timeouts
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +02001136----------------------
1137
1138Here is the list of all known errors:
1139
1140 STATUS CODE | DESCRIPTION
1141 ----------------+--------------------------------------------------------
1142 0 | normal (no error occurred)
1143 1 | I/O error
1144 2 | A timeout occurred
1145 3 | frame is too big
1146 4 | invalid frame received
1147 5 | version value not found
1148 6 | max-frame-size value not found
1149 7 | capabilities value not found
1150 8 | unsupported version
1151 9 | max-frame-size too big or too small
Christopher Fauletd1307ce2017-02-27 21:59:39 +01001152 10 | payload fragmentation is not supported
1153 11 | invalid interlaced frames
1154 12 | frame-id not found (it does not match any referenced frame)
1155 13 | resource allocation error
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +02001156 99 | an unknown error occurrde
1157 ----------------+--------------------------------------------------------
1158
1159An agent can define its own errors using a not yet assigned status code.
1160
Christopher Fauletea62c2a2016-11-14 10:54:21 +01001161IMPORTANT NOTE: By default, for a specific stream, when an abnormal/unexpected
1162 error occurs, the SPOE is disabled for all the transaction. So
1163 if you have several events configured, such error on an event
1164 will disabled all followings. For TCP streams, this will
1165 disable the SPOE for the whole session. For HTTP streams, this
1166 will disable it for the transaction (request and response).
1167 See 'option continue-on-error' to bypass this limitation.
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +02001168
1169To avoid a stream to wait infinitly, you must carefully choose the
1170acknowledgement timeout. In most of cases, it will be quiet low. But it depends
1171on the responsivness of your service.
1172
1173You must also choose idle timeout carefully. Because connection with your
1174service depends on the backend configuration used by the SPOA, it is important
1175to use a lower value for idle timeout than the server timeout. Else the
1176connection will be closed by HAProxy. The same is true for hello timeout. You
1177should choose a lower value than the connect timeout.
1178
Christopher Fauletb2dd1e02018-03-22 09:07:41 +010011794. Logging
1180-----------
1181
1182Activity of an SPOE is logged using HAProxy's logger. The messages are logged
1183in the context of the streams that handle the client and the server
1184connections. A message is emitted for each event or group handled by an
1185SPOE. Depending on the status code, the log level will be different. In the
1186normal case, when no error occurred, the message is logged with the level
1187LOG_NOTICE. Otherwise, the message is logged with the level LOG_WARNING.
1188
1189The messages are logged using the stream's logger and use the following format:
1190
1191 SPOE: [AGENT] <TYPE:NAME> sid=STREAM-ID st=STATUC-CODE reqT/qT/wT/resT/pT
1192
1193 AGENT is the agent name
1194 TYPE is EVENT of GROUP
1195 NAME is the event or the group name
1196 STREAM-ID is an integer, the unique id of the stream
1197 STATUS_CODE is the processing's status code
1198 reqT/qT/wT/resT/pT are the following time events:
1199
1200 * reqT : the encoding time. It includes ACLs processing, if any. For
1201 fragmented frames, it is the sum of all fragments.
1202 * qT : the delay before the request gets out the sending queue. For
1203 fragmented frames, it is the sum of all fragments.
1204 * wT : the delay before the reponse is received. No fragmentation
1205 supported here.
1206 * resT : the delay to process the response. No fragmentation supported
Christopher Faulet36bda1c2018-03-22 09:08:20 +01001207 here.
Christopher Fauletb2dd1e02018-03-22 09:07:41 +01001208 * pT : the delay to process the event or the group. From the stream
Christopher Faulet36bda1c2018-03-22 09:08:20 +01001209 point of view, it is the latency added by the SPOE processing.
1210 It is more or less the sum of values above.
Christopher Fauletb2dd1e02018-03-22 09:07:41 +01001211
1212For all these time events, -1 means the processing was interrupted before the
1213end. So -1 for the queue time means the request was never dequeued. For
1214fragmented frames it is harder to know when the interruption happened.
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +02001215
1216/*
1217 * Local variables:
1218 * fill-column: 79
1219 * End:
1220 */