Td-agent lost some file when use tail input plugin
td-agent version: 2.3.4-0 OS: Docker container , base image is: Ubuntu 14.04 td-agent.conf
<source>
@type forward
port 24224
</source>
<source>
@type http
port 24225
bind 127.0.0.1
</source>
<source>
@type tail
path /scan_dir/bb60b073f01f7e793a1ac14e0364db088fe97b5d895fc1b631765c05964feaeb/app/*.log
pos_file /pos_file/c294d3746493371c5e2dc78aea463d62caf6ddaedaec990b463e0bc7435f7845.pos
tag file.c294d3746493.app.*
refresh_interval 1s
read_from_head true
format none
keep_time_key true
message_key log_data
</source>
<source>
@type tail
path /scan_dir/bb60b073f01f7e793a1ac14e0364db088fe97b5d895fc1b631765c05964feaeb/app/log/*.log
pos_file /pos_file/c294d3746493371c5e2dc78aea463d62caf6ddaedaec990b463e0bc7435f7845.pos
tag file.c294d3746493.app-log.*
refresh_interval 1s
read_from_head true
format none
keep_time_key true
message_key log_data
</source>
<source>
@type tail
path /scan_dir/bb60b073f01f7e793a1ac14e0364db088fe97b5d895fc1b631765c05964feaeb/log/*.log
pos_file /pos_file/c294d3746493371c5e2dc78aea463d62caf6ddaedaec990b463e0bc7435f7845.pos
tag file.c294d3746493.log.*
refresh_interval 1s
read_from_head true
format none
keep_time_key true
message_key log_data
</source>
<source>
@type tail
path /scan_dir/1beed43f1178f7ed7497193b6880d4264a5044dc8515a0de5881d915c1efbd40/app/*.log
pos_file /pos_file/45bb09ebea4f370985955c4c0d63cb3ae75f13ec9321d92d82d9482330a5a818.pos
tag file.45bb09ebea4f.app.*
refresh_interval 1s
read_from_head true
format none
keep_time_key true
message_key log_data
</source>
<source>
@type tail
path /scan_dir/1beed43f1178f7ed7497193b6880d4264a5044dc8515a0de5881d915c1efbd40/app/log/*.log
pos_file /pos_file/45bb09ebea4f370985955c4c0d63cb3ae75f13ec9321d92d82d9482330a5a818.pos
tag file.45bb09ebea4f.app-log.*
refresh_interval 1s
read_from_head true
format none
keep_time_key true
message_key log_data
</source>
<source>
@type tail
path /scan_dir/1beed43f1178f7ed7497193b6880d4264a5044dc8515a0de5881d915c1efbd40/log/*.log
pos_file /pos_file/45bb09ebea4f370985955c4c0d63cb3ae75f13ec9321d92d82d9482330a5a818.pos
tag file.45bb09ebea4f.log.*
refresh_interval 1s
read_from_head true
format none
keep_time_key true
message_key log_data
</source>
<source>
@type tail
path /scan_dir/f6b3d73a16a9af32f8358c35d2df310fa8764b18ca8a305ee2427e33048938b3/app/log/*.log
pos_file /pos_file/513365b152fa3f4177afed8b0266864fe05e3c275af77114a2e04afba750d47c.pos
tag file.513365b152fa.app-log.*
refresh_interval 1s
read_from_head true
format none
keep_time_key true
message_key log_data
</source>
<source>
@type tail
path /scan_dir/879afa8978aa1044d00dce433f1f94b849675fa6267c780945425ce439004f66/app/log/*.log
pos_file /pos_file/c8738548942b4c320eedd23520c01d1a28cb297ce254380b87da44b003791737.pos
tag file.c8738548942b.app-log.*
refresh_interval 1s
read_from_head true
format none
keep_time_key true
message_key log_data
</source>
<source>
@type tail
path /scan_dir/879afa8978aa1044d00dce433f1f94b849675fa6267c780945425ce439004f66/log/*.log
pos_file /pos_file/c8738548942b4c320eedd23520c01d1a28cb297ce254380b87da44b003791737.pos
tag file.c8738548942b.log.*
refresh_interval 1s
read_from_head true
format none
keep_time_key true
message_key log_data
</source>
<source>
@type tail
path /scan_dir/9bf202d484a7225985931260869e607864a5b38014820fa3ee69e0faf82fad8f/app/log/*.log
pos_file /pos_file/db223c48062af839205bd5cc287be1740c95780a6cce7d6a2be7a3192a0c2b31.pos
tag file.db223c48062a.app-log.*
refresh_interval 1s
read_from_head true
format none
keep_time_key true
message_key log_data
</source>
<source>
@type tail
path /scan_dir/634e1f2de4b76a003dcf8919485952af0220d300b7e6ef946c2c977d1b7fc36c/app/log/*.log
pos_file /pos_file/99cb03d67453f813dcd9c90a202e761cd6ac0b1c9137924c19717376aef6e510.pos
tag file.99cb03d67453.app-log.*
refresh_interval 1s
read_from_head true
format none
keep_time_key true
message_key log_data
</source>
<source>
@type tail
path /scan_dir/66c2ec10d19c86d56ba468d59de50569c5c991152d695090d11770cd8eaca57d/app/big5_imgset_updater_log/*.log
pos_file /pos_file/2fb5c7dfb0a46e6c18c30565eed0722712ad6657eb26aa149d8a6cb650bd1f24.pos
tag file.2fb5c7dfb0a4.app-big5_imgset_updater_log.*
refresh_interval 1s
read_from_head true
format none
keep_time_key true
message_key log_data
</source>
<source>
@type tail
path /scan_dir/66c2ec10d19c86d56ba468d59de50569c5c991152d695090d11770cd8eaca57d/app/log/*.log
pos_file /pos_file/2fb5c7dfb0a46e6c18c30565eed0722712ad6657eb26aa149d8a6cb650bd1f24.pos
tag file.2fb5c7dfb0a4.app-log.*
refresh_interval 1s
read_from_head true
format none
keep_time_key true
message_key log_data
</source>
<source>
@type tail
path /scan_dir/91560acb048a88e45525e71f9089f6984f2799c19dbd718c22989661cb07db73/app/log/*.log
pos_file /pos_file/84a2525c19a6333302f23e1aa9d30914cc65aae9cdf6fd43f4bca347e7e35150.pos
tag file.84a2525c19a6.app-log.*
refresh_interval 1s
read_from_head true
format none
keep_time_key true
message_key log_data
</source>
<match *.*.**>
type copy
<store>
type http_buffered
endpoint_url http://xxxx:8080/logs/services/
http_retry_statuses 500,403,503,504
http_read_timeout 60
http_open_timeout 30
flush_interval 3s
buffer_type file
retry_limit 5
retry_wait 4s
buffer_path /buffer/
<secondary>
@type file
path /var/log/mathilde/backup
</secondary>
</store>
</match>
The log in /var/log/td-agent/td-agent.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/f7f2126ea32d5cbb74371743946fa2c94b503631cbc47eb20d6a218b45801cac/app/log/spam_comment.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/f7f2126ea32d5cbb74371743946fa2c94b503631cbc47eb20d6a218b45801cac/app/log/all_comment.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/bb60b073f01f7e793a1ac14e0364db088fe97b5d895fc1b631765c05964feaeb/app/img_provider_big5.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/bb60b073f01f7e793a1ac14e0364db088fe97b5d895fc1b631765c05964feaeb/app/log/production.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/bb60b073f01f7e793a1ac14e0364db088fe97b5d895fc1b631765c05964feaeb/app/log/nginx.error.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/bb60b073f01f7e793a1ac14e0364db088fe97b5d895fc1b631765c05964feaeb/app/log/newrelic_agent.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/bb60b073f01f7e793a1ac14e0364db088fe97b5d895fc1b631765c05964feaeb/app/log/unicorn.stdout.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/bb60b073f01f7e793a1ac14e0364db088fe97b5d895fc1b631765c05964feaeb/app/log/analysis_detailed.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/bb60b073f01f7e793a1ac14e0364db088fe97b5d895fc1b631765c05964feaeb/app/log/unicorn.stderr.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/bb60b073f01f7e793a1ac14e0364db088fe97b5d895fc1b631765c05964feaeb/app/log/nginx.access.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/1beed43f1178f7ed7497193b6880d4264a5044dc8515a0de5881d915c1efbd40/app/img_provider_big5.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/1beed43f1178f7ed7497193b6880d4264a5044dc8515a0de5881d915c1efbd40/app/log/production.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/1beed43f1178f7ed7497193b6880d4264a5044dc8515a0de5881d915c1efbd40/app/log/nginx.error.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/1beed43f1178f7ed7497193b6880d4264a5044dc8515a0de5881d915c1efbd40/app/log/newrelic_agent.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/1beed43f1178f7ed7497193b6880d4264a5044dc8515a0de5881d915c1efbd40/app/log/unicorn.stdout.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/1beed43f1178f7ed7497193b6880d4264a5044dc8515a0de5881d915c1efbd40/app/log/analysis_detailed.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/1beed43f1178f7ed7497193b6880d4264a5044dc8515a0de5881d915c1efbd40/app/log/unicorn.stderr.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/1beed43f1178f7ed7497193b6880d4264a5044dc8515a0de5881d915c1efbd40/app/log/nginx.access.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/f6b3d73a16a9af32f8358c35d2df310fa8764b18ca8a305ee2427e33048938b3/app/log/nginx.error.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/f6b3d73a16a9af32f8358c35d2df310fa8764b18ca8a305ee2427e33048938b3/app/log/nginx.access.log
2017-04-12 18:01:32 +0000 [info]: following tail of /scan_dir/879afa8978aa1044d00dce433f1f94b849675fa6267c780945425ce439004f66/app/log/production.log
Td-agent can tail logs of file. But td-agent misses some of the log file. I have 5 log files in /scan_dir/879afa8978aa1044d00dce433f1f94b849675fa6267c780945425ce439004f66/app/log/ But it only tail one.
the files in /scan_dir/879afa8978aa1044d00dce433f1f94b849675fa6267c780945425ce439004f66/app/log:
root@10:/scan_dir/879afa8978aa1044d00dce433f1f94b849675fa6267c780945425ce439004f66/app/log# ls
analysis_detailed.log analysis_detailed.log.1 analysis_roughly.log newrelic_agent.log production.log
Td-agent works well 12 hours ago. I don't know what happened that make td-agent can't tail log file anymore.
I tried to:
- restart td-agent => not work.
- remove some line in the the pos file => not work.
- reproduce this in another environment => failed. I hit this issue only at one node.
Not quite sure this is bug or not. What can I do to debug it.
Do you guys need more info?
I first heard this problem.
reproduce this in another environment => failed. I hit this issue only at one node.
This means your node has a problem for file visibility, so you need to debug it on your environment.
https://github.com/fluent/fluentd/blob/423cf7f9cf27950d89e7814fb3039b027b501924/lib/fluent/plugin/in_tail.rb#L151
Here is in_tail code for v0.12. You can check inserting p xxx for which point removes target files from watching list.
BTW, you don't share pos_file between multiple in_tail. See document first: http://docs.fluentd.org/v0.12/articles/in_tail#posfile-highly-recommended In addition, "refresh_interval 1s" seems not good because path expansion may be delayed on high load environment.
@repeatedly Thank you for your quick response. I will debug it.
Hi @repeatedly Sorry for taking a long time to reply.
I found more details. As you see the config file above. If I put the
<source>
@type forward
port 24224
</source>
to the end of the config file. Fluentd will never listen 24224.
It seems fluentd parse/execute the config file by order. And it may quit the parsing action somehow and ignore the rest of the config. This is why fluentd just tail some of the files I think.
I found this because When fluentd in high load, I restart it, and found it never listen 24224. after I put the forward settings to the top of the config and restart fluentd. it recoverd.
Hi @repeatedly
More details. I add some log in the in_tail.rb. and find all the tail-path can find in the function configure , only some of the tail-paths which in the front of td-agent.conf can find in function expand_paths .
What should I do next?
Looking forward your reply.
only some of the tail-paths which in the front of td-agent.conf can find in function expand_paths.
Does it mean Dir.glob in expand_path doesn't return all target files?
@repeatedly No. I can't find my configed path in @paths in expand_paths.
It seems fluentd will run the configure function for every configure.
In my scenario: configure can be called 10 times. but expand_paths was called just by some of the
Another issue like you said. I hit the scenario: Some of the paths in the same config chunk can be tailed the other can't. I can't reproduce it right now. When I hit it again. I will do more debug.
This issue has been automatically marked as stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 30 days
This issue was automatically closed because of stale in 30 days