Skip to content

Commit

Permalink
in_tcp: add Windows support (fluent#1831)
Browse files Browse the repository at this point in the history
I know some Windows users use Fluentd's `in_tcp` plugin to accumulate
data from internal services. This is very useful -- e.g. to collect
logs from .NET applications running in internal network.

This should allow users to do the same thing with Fluent Bit.

Signed-off-by: Fujimoto Seiji <fujimoto@clear-code.com>
  • Loading branch information
Fujimoto Seiji authored and edsiper committed Dec 23, 2019
1 parent 44a7e49 commit 93d4d53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmake/windows-setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set(FLB_IN_SERIAL No)
set(FLB_IN_STDIN No)
set(FLB_IN_SYSLOG No)
set(FLB_IN_TAIL Yes)
set(FLB_IN_TCP No)
set(FLB_IN_TCP Yes)
set(FLB_IN_MQTT No)
set(FLB_IN_HEAD No)
set(FLB_IN_PROC No)
Expand Down
10 changes: 5 additions & 5 deletions plugins/in_tcp/tcp_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ int tcp_conn_event(void *data)
}

/* Read data */
bytes = read(conn->fd,
conn->buf_data + conn->buf_len, available);
bytes = recv(conn->fd,
conn->buf_data + conn->buf_len, available, 0);
if (bytes <= 0) {
flb_trace("[in_tcp] fd=%i closed connection", event->fd);
tcp_conn_del(conn);
Expand Down Expand Up @@ -299,7 +299,7 @@ struct tcp_conn *tcp_conn_add(int fd, struct flb_in_tcp_config *ctx)
conn->buf_data = flb_malloc(ctx->chunk_size);
if (!conn->buf_data) {
flb_errno();
close(fd);
flb_socket_close(fd);
flb_error("[in_tcp] could not allocate new connection");
flb_free(conn);
return NULL;
Expand All @@ -317,7 +317,7 @@ struct tcp_conn *tcp_conn_add(int fd, struct flb_in_tcp_config *ctx)
ret = mk_event_add(ctx->evl, fd, FLB_ENGINE_EV_CUSTOM, MK_EVENT_READ, conn);
if (ret == -1) {
flb_error("[in_tcp] could not register new connection");
close(fd);
flb_socket_close(fd);
flb_free(conn->buf_data);
flb_free(conn);
return NULL;
Expand All @@ -342,7 +342,7 @@ int tcp_conn_del(struct tcp_conn *conn)

/* Release resources */
mk_list_del(&conn->_head);
close(conn->fd);
flb_socket_close(conn->fd);
flb_free(conn->buf_data);
flb_free(conn);

Expand Down

0 comments on commit 93d4d53

Please sign in to comment.