Skip to content

Commit 4891fa3

Browse files
committed
change option name --follow_inodes to --follow-inodes
It would be more natural using '-' for the word separator as command line. Note: OptionParser can accept --follow_inodes as well. Signed-off-by: Daijiro Fukuda <fukuda@clear-code.com>
1 parent 405f39c commit 4891fa3

5 files changed

Lines changed: 17 additions & 10 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@ You can use wildcards:
154154
$ tailcheck /var/log/td-agent/pos/*
155155
```
156156

157-
If you use [follow_inodes](https://docs.fluentd.org/input/tail#follow_inodes), then you must specify `--follow_inodes` option.
157+
If you use [follow_inodes](https://docs.fluentd.org/input/tail#follow_inodes), then you must specify `--follow-inodes` option.
158158
(If you have both settings that use `follow_inodes` and those that do not, please run the command separately.)
159159

160160
```console
161-
$ tailcheck --follow_inodes /var/log/td-agent/pos/secure
161+
$ tailcheck --follow-inodes /var/log/td-agent/pos/secure
162162
```
163163

164164
You can change the minimum ratio of collection of each target log file by specify `--ratio DECIMAL`.
@@ -287,13 +287,13 @@ Especially, if the `in_tail` uses [follow_inodes](https://docs.fluentd.org/input
287287

288288
`tailcheck` checks the sizes of logfiles based on the paths recorded in the pos files (except already unwatched pos entries).
289289

290-
However, if using `--follow_inodes`, there is a restriction on which files can be checked.
291-
If using `--follow_inodes`, it is possible that `tailcheck` can not check the already rotated logfiles even if they are recorded in the pos files and are not unwatched yet.
290+
However, if using `--follow-inodes`, there is a restriction on which files can be checked.
291+
If using `--follow-inodes`, it is possible that `tailcheck` can not check the already rotated logfiles even if they are recorded in the pos files and are not unwatched yet.
292292
Since the path recorded in the pos file is not updated after log rotation, the current path and inode may differ.
293293
`tailcheck` checks only log files whose path and inode in the pos file match.
294294
At least, it can check the current log files.
295295

296-
If not using `--follow_inodes`, this limitation does not exist.
296+
If not using `--follow-inodes`, this limitation does not exist.
297297

298298
## Development
299299

lib/fluent/tail_checker/tail_check.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ def parse_command_line(argv)
4242
Usage: tailcheck [OPTIONS] POS_FILE...
4343
Example: tailcheck /path/to/pos1 /path/to/pos2
4444
Example: tailcheck /path/to/pos/*
45-
Example: tailcheck --follow_inodes /path/to/pos_with_follow_inodes
45+
Example: tailcheck --follow-inodes /path/to/pos_with_follow_inodes
4646
4747
If you have any issues with this command, please report it to https://github.com/clear-code/fluent-tail_checker/issues.
4848
4949
Options:
5050
BANNER
5151

52-
parser.on("--follow_inodes", "Check the specified pos files with the condition that the follow_inodes feature is enabled.", "Default: Disabled") do
52+
parser.on("--follow-inodes", "Check the specified pos files with the condition that the follow_inodes feature is enabled.", "Default: Disabled") do
5353
@follow_inodes = true
5454
end
5555
parser.on("--ratio NUM", Float, "Minimum ratio of collection of each target log file to accept.", "Default: #{@collection_ratio_threshold}") do |v|

test/fluent/tail_checker_test.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,17 @@ class Fluent::TailCheckerTest < Test::Unit::TestCase
2020
data(
2121
"Full",
2222
[
23-
["--follow_inodes", "--ratio", "0.7", "/path/to/pos", "/path/to/pos2"],
23+
["--follow-inodes", "--ratio", "0.7", "/path/to/pos", "/path/to/pos2"],
2424
{ pos_filepaths: ["/path/to/pos", "/path/to/pos2"], follow_inodes: true, collection_ratio_threshold: 0.7 },
2525
]
2626
)
27+
data(
28+
"--follow_inodes (using underscore)",
29+
[
30+
["--follow_inodes", "/path/to/pos"],
31+
{ pos_filepaths: ["/path/to/pos"], follow_inodes: true, collection_ratio_threshold: 0.5 },
32+
]
33+
)
2734
test "Correct args" do |(args, expected)|
2835
tail_check = Fluent::TailChecker::TailCheck.new
2936

test/script/command-test.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ tailcheck --version
66
tailcheck --help
77
tailcheck test/data/pos_normal
88
(! tailcheck test/data/pos_normal test/data/pos_duplicate_unwatched_path)
9-
tailcheck --follow_inodes test/data/pos_follow_inodes_normal
9+
tailcheck --follow-inodes test/data/pos_follow_inodes_normal

test/script/command-test.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ call tailcheck test/data/pos_normal || exit /b 1
1111
call tailcheck test/data/pos_normal test/data/pos_duplicate_unwatched_path && exit /b 1
1212

1313
@echo on
14-
call tailcheck --follow_inodes test/data/pos_follow_inodes_normal || exit /b 1
14+
call tailcheck --follow-inodes test/data/pos_follow_inodes_normal || exit /b 1

0 commit comments

Comments
 (0)