Skip to content

Commit e8d9673

Browse files
committed
in_http: add fluentd like add_remote_addr functionality
Signed-off-by: Alexandre Létourneau <letourneau.alexandre@gmail.com>
1 parent 6345fd1 commit e8d9673

File tree

4 files changed

+404
-83
lines changed

4 files changed

+404
-83
lines changed

plugins/in_http/http.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,18 @@ static struct flb_config_map config_map[] = {
207207
NULL
208208
},
209209

210+
{
211+
FLB_CONFIG_MAP_BOOL, "add_remote_addr", "false",
212+
0, FLB_TRUE, offsetof(struct flb_http, add_remote_addr),
213+
"Adds REMOTE_ADDR field to the record. The value of REMOTE_ADDR is the client's address."
214+
},
215+
216+
{
217+
FLB_CONFIG_MAP_STR, "remote_addr_key", REMOTE_ADDR_KEY,
218+
0, FLB_TRUE, offsetof(struct flb_http, remote_addr_key),
219+
"Key name for the remote address field added to the record."
220+
},
221+
210222
{
211223
FLB_CONFIG_MAP_SIZE, "buffer_max_size", HTTP_BUFFER_MAX_SIZE,
212224
0, FLB_TRUE, offsetof(struct flb_http, buffer_max_size),

plugins/in_http/http.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
#define HTTP_BUFFER_MAX_SIZE "4M"
3434
#define HTTP_BUFFER_CHUNK_SIZE "512K"
35+
#define REMOTE_ADDR_KEY "REMOTE_ADDR"
3536

3637
struct flb_http {
3738
int successful_response_code;
@@ -47,6 +48,9 @@ struct flb_http {
4748

4849
struct flb_input_instance *ins;
4950

51+
int add_remote_addr;
52+
const char *remote_addr_key;
53+
5054
/* New gen HTTP server */
5155
int enable_http2;
5256
struct flb_http_server http_server;

0 commit comments

Comments
 (0)