Skip to content

Commit 2f78623

Browse files
committed
improve log messages
Signed-off-by: Daijiro Fukuda <[email protected]>
1 parent a24c41d commit 2f78623

File tree

4 files changed

+30
-24
lines changed

4 files changed

+30
-24
lines changed

README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ $ tailcheck --follow_inodes /var/log/td-agent/pos/secure
167167

168168
```
169169
Check /path/to/pos.
170-
Checked duplicated pos for 2 PosEntries.
171-
Checked collection ratio of 2 files.
170+
Done duplication check for 2 PosEntries.
171+
Done collection ratio check for 2 files.
172172
173173
All check completed.
174174
There is no anomalies.
@@ -177,40 +177,40 @@ There is no anomalies.
177177
This means:
178178

179179
* The command has checked `/path/to/pos`.
180-
* The command has checked 2 entries for duplication check.
180+
* The command has checked 2 pos entries for duplication check.
181181
* The command has checked 2 files for collection ratio check.
182182
* There is no anomalies.
183183

184184
#### Pos duplication found
185185

186186
```
187187
Check /path/to/pos.
188-
Checked duplicated pos for 3 PosEntries.
189-
Duplicated PosEntries are found. This is a known log loss issue that was fixed in Fluentd v1.16.3.
190-
Duplicated keys:
188+
Done duplication check for 3 PosEntries.
189+
Duplicated PosEntries are found. This is a known log missing issue that was fixed in Fluentd v1.16.3 (fluent-package v5.0.2, td-agent v4.5.2). If you are using any version older than these, updating Fluentd will resolve the issue.
190+
Duplicated paths:
191191
/test/foo.log
192-
Checked collection ratio of 0 files.
192+
Done collection ratio check for 0 files.
193193
194194
All check completed.
195195
Some anomalies are found. Please check whether there is any log loss.
196196
```
197197

198-
In this case, some keys of the pos entries are duplicated.
198+
In this case, some the pos entries are duplicated.
199199
It is a known log missing issue that was fixed in Fluentd v1.16.3.
200200

201201
> * https://github.com/fluent/fluentd/issues/3614
202202
> * In case `follow_inodes false` (default setting), collection of a file may stop and continue to stop after log rotation.
203203
> * Fixed since Fluentd v1.16.3 (fluent-package v5.0.2, td-agent v4.5.2).
204204
205-
So, you should check whether there is any log missing, and consider updating, especially, if your version is before Fluentd v1.16.3 (fluent-package v5.0.2, td-agent v4.5.2).
205+
So, you should check whether there is any log missing, and consider updating Fluentd, especially, if you are using any version older than Fluentd v1.16.3 (fluent-package v5.0.2, td-agent v4.5.2).
206206

207207
#### Too low collection ratio file found
208208

209209
```
210210
Check /path/to/pos.
211-
Checked duplicated pos for 2 PosEntries.
212-
Checked collection ratio of 2 files.
213-
Collection ratio of some files are too low. Collection of those files may have stopped or may not be keeping up.
211+
Done duplication check for 2 PosEntries.
212+
Done collection ratio check for 2 files.
213+
Collection ratio of some files are too low. Collection of those files may not be keeping up. Or it may have stopped with some anomalies. This can be a known log missing issue of the follow_inodes feature that was fixed in Fluentd v1.16.2 (fluent-package v5.0.0, td-agent v4.5.1). If you are using any version older than these, updating Fluentd will resolve the issue.
214214
Filepaths with too low collection ratio (threshold: 0.8):
215215
/test/bar.log (ratio: 0.7)
216216
/test/foo.log (ratio: 0.7)
@@ -234,8 +234,7 @@ Especially, if the `in_tail` uses [follow_inodes](https://docs.fluentd.org/input
234234
> * In case `follow_inodes true`, collection of a file may stop and continue to stop after log rotation.
235235
> * Fixed since Fluentd v1.16.2 (fluent-package v5.0.0, td-agent v4.5.1).
236236
237-
If this issue is occurring, this too low collection ratio is detected.
238-
In that case, please consider updating if your version is before Fluentd v1.16.2 (td-agent v4.5.1).
237+
Please consider updating Fluentd if you are using any version older than Fluentd v1.16.2 (td-agent v4.5.1).
239238

240239
## Development
241240

lib/fluent/tail_checker/collection_ratio_checker.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def check
5454
end
5555
end
5656

57-
puts "Checked collection ratio of #{checked_file_counts} files."
57+
puts "Done collection ratio check for #{checked_file_counts} files."
5858

5959
if unacceptable_collection_ratio_found
6060
log_issue(unacceptable_collection_ratio_path_and_ratio_list)
@@ -96,9 +96,10 @@ def collection_ratio(pos, file_size)
9696
end
9797

9898
def log_issue(path_and_ratio_list)
99-
puts "Collection ratio of some files are too low. Collection of those files may have stopped or may not be keeping up."
10099
if @follow_inodes
101-
puts "This can be a known log loss issue of the follow_inodes feature that was fixed in Fluentd v1.16.2."
100+
puts "Collection ratio of some files are too low. Collection of those files may not be keeping up. Or it may have stopped with some anomalies. This can be a known log missing issue of the follow_inodes feature that was fixed in Fluentd v1.16.2 (fluent-package v5.0.0, td-agent v4.5.1). If you are using any version older than these, updating Fluentd will resolve the issue."
101+
else
102+
puts "Collection ratio of some files are too low. Collection of those files may not be keeping up. Or it may have stopped with some anomalies. It is recommended to verify whether there is any log missing."
102103
end
103104

104105
puts "Filepaths with too low collection ratio (threshold: #{@collection_ratio_threshold}):"

lib/fluent/tail_checker/duplicated_pos_checker.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def check
4040
duplicated_key_set.add(key)
4141
end
4242

43-
puts "Checked duplicated pos for #{checked_key_counts} PosEntries."
43+
puts "Done duplication check for #{checked_key_counts} PosEntries."
4444

4545
if duplicated_key_found
4646
log_issue(duplicated_key_set)
@@ -52,12 +52,13 @@ def check
5252

5353
def log_issue(duplicated_keys)
5454
if @follow_inodes
55-
puts "Duplicated PosEntries are found with follow_inodes. Unknown anomalies may be occurring."
55+
puts "Duplicated PosEntries are found. Unknown anomalies may be occurring. It is recommended to verify whether there is any log missing."
56+
puts "Duplicated inodes:"
5657
else
57-
puts "Duplicated PosEntries are found. This is a known log loss issue that was fixed in Fluentd v1.16.3."
58+
puts "Duplicated PosEntries are found. This is a known log missing issue that was fixed in Fluentd v1.16.3 (fluent-package v5.0.2, td-agent v4.5.2). If you are using any version older than these, updating Fluentd will resolve the issue."
59+
puts "Duplicated paths:"
5860
end
5961

60-
puts "Duplicated keys:"
6162
duplicated_keys.each do |key|
6263
puts " #{key}"
6364
end

lib/fluent/tail_checker/tail_check.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ def parse_command_line(argv)
4242
Example: tailcheck /path/to/pos1 /path/to/pos2
4343
Example: tailcheck /path/to/pos/*
4444
Example: tailcheck --follow_inodes /path/to/pos_with_follow_inodes
45-
Options:
4645
46+
If you have any issues with this command, please report it to https://github.com/clear-code/fluent-tail_checker/issues.
47+
48+
Options:
4749
BANNER
4850

4951
parser.on("--follow_inodes", "Check the specified pos files with the condition that the follow_inodes feature is enabled.", "Default: Disabled") do
@@ -86,8 +88,11 @@ def check
8688
puts "\nAll check completed."
8789

8890
unless succeeded
89-
puts "Some anomalies are found. Please check whether there is any log loss."
90-
# TODO add message about how to concact the community or us.
91+
puts "Some anomalies are found. Please check the logs for details."
92+
puts "If you have any questions or issues, please report them to the following:"
93+
puts " Fluentd Q&A: https://github.com/fluent/fluentd/discussions/categories/q-a"
94+
puts " Fluentd Q&A (日本語用): https://github.com/fluent/fluentd/discussions/categories/q-a-japanese"
95+
puts " About this command (日本語可): https://github.com/clear-code/fluent-tail_checker/issues"
9196
return false
9297
end
9398

0 commit comments

Comments
 (0)