@@ -11,6 +11,7 @@ import (
1111 "github.com/ozontech/file.d/fd"
1212 "github.com/ozontech/file.d/metric"
1313 "github.com/ozontech/file.d/pipeline"
14+ "github.com/ozontech/file.d/xtime"
1415 "github.com/ozontech/file.d/xtls"
1516 "go.uber.org/zap"
1617 "go.uber.org/zap/zapcore"
@@ -20,7 +21,8 @@ import (
2021It sends events to a socket endpoint.
2122Supports TCP, UDP, and Unix socket protocols.
2223
23- Events are sent in batches serialized as newline-delimited JSON, compatible with the socket input plugin.
24+ Events are sent in batches serialized as newline-delimited JSON by default, compatible with the socket input plugin.
25+ The delimiter used to separate messages is configurable and can be changed in the plugin configuration (default: `\n`).
2426If a network error occurs, the batch will be retried according to the backoff settings.
2527
2628Supports [dead queue](/plugin/output/README.md#dead-queue).
@@ -36,6 +38,7 @@ pipelines:
3638 type: socket
3739 network: tcp
3840 address: ':6666'
41+ delimiter: '\t'
3942 ...
4043```
4144---
@@ -48,6 +51,7 @@ pipelines:
4851 type: socket
4952 network: tcp
5053 address: ':6666'
54+ delimiter: '\n'
5155 ca_cert: './client.pem'
5256 private_key: './client.key'
5357 ...
@@ -118,6 +122,12 @@ type Config struct {
118122 // > - /tmp/filed.sock
119123 Address string `json:"address" required:"true"` // *
120124
125+ // > @3@4@5@6
126+ // >
127+ // > Delimiter to append after each event. Must be exactly one byte.
128+ Delimiter string `json:"delimiter" default:"\n"` // *
129+ Delimiter_ byte
130+
121131 // > @3@4@5@6
122132 // >
123133 // > Client certificate in PEM encoding. This can be a path or the contents of the file.
@@ -140,6 +150,7 @@ type Config struct {
140150 // >
141151 // > Timeout for writing a single batch to the socket.
142152 // >> Set to `0` to disable.
153+ // >> **Must be at least `1s` if non-zero.**
143154 WriteTimeout cfg.Duration `json:"write_timeout" default:"5s" parse:"duration"` // *
144155 WriteTimeout_ time.Duration
145156
@@ -195,12 +206,6 @@ type Config struct {
195206 // >
196207 // > Multiplier for exponential increase of retention between retries
197208 RetentionExponentMultiplier int `json:"retention_exponentially_multiplier" default:"2"` // *
198-
199- // > @3@4@5@6
200- // >
201- // > Delimiter to append after each event. Must be exactly one byte.
202- Delimiter string `json:"delimiter" default:"\n"` // *
203- Delimiter_ byte
204209}
205210
206211type data struct {
@@ -357,7 +362,7 @@ func (p *Plugin) out(workerData *pipeline.WorkerData, batch *pipeline.Batch) err
357362 data .outBuf = outBuf
358363
359364 if p .config .WriteTimeout_ > 0 {
360- _ = data .conn .SetWriteDeadline (time . Now ().Add (p .config .WriteTimeout_ ))
365+ _ = data .conn .SetWriteDeadline (xtime . GetInaccurateTime ().Add (p .config .WriteTimeout_ ))
361366 }
362367
363368 if err := writeAll (data .conn , data .outBuf ); err != nil {
0 commit comments