Monday, 15 July 2013

spring xd - SpringXD stream with Tail source reads ALL the lines in file again and again instead of just last n lines -



spring xd - SpringXD stream with Tail source reads ALL the lines in file again and again instead of just last n lines -

stream create --name tailtest --definition "tail --name=/users/name/documents/springxd/poc/input/try.txt --outputtype=text/plain --lines=1 |file --name=output --dir=/users/name/documents/springxd/poc/output --mode=append" --deploy

here see whether give --lines=1 or 2 or 0 there additional line entered in try.txt , saved, reading entire try.txt , dumping output file. 1 time again when add together line try.txt same reads entire file content rather lastly line , appends @ end of previous content in output, thought going wrong here, why tail not read lastly 1 (or specified n) lines set come in @ end of each line in input file?

it sounds replacing file when "and saved".

tail follows existing file and, yes, expects newline terminate new message.

i ran test , works fine...

xd:>stream create --name foo --definition "tail --lines=1 --name=/users/foo/documents/foo.txt | log" --deploy

logs lastly line of file,

23:15:58,925 info simpleasynctaskexecutor-1 sink.foo - sdsd

then

$ echo foo >> ~/documents/foo.txt

(which appends foo\n file)

results in

23:17:07,744 info simpleasynctaskexecutor-1 sink.foo - foo

the lines=1 applies existing file; if replace file new one, whole file used - log rotation.

tail spring-xd

No comments:

Post a Comment