diff --git a/filebeat/crawler/registrar.go b/filebeat/crawler/registrar.go index 6746a4f5d86..f31e6a1309b 100644 --- a/filebeat/crawler/registrar.go +++ b/filebeat/crawler/registrar.go @@ -64,7 +64,7 @@ func (r *Registrar) Init() error { } // loadState fetches the previous reading state from the configure RegistryFile file -// The default file is .filebeat file which is stored in the same path as the binary is running +// The default file is `registry` in the data path. func (r *Registrar) LoadState() { if existing, e := os.Open(r.registryFile); e == nil { defer existing.Close() diff --git a/filebeat/docs/migration.asciidoc b/filebeat/docs/migration.asciidoc index db8f12804a5..230c8bd826d 100644 --- a/filebeat/docs/migration.asciidoc +++ b/filebeat/docs/migration.asciidoc @@ -41,7 +41,7 @@ The registry file stores the state and location information that Filebeat uses t where it was last reading. Under Logstash Forwarder, this file was called `.logstash-fowarder`. For Filebeat, the file was renamed. The name varies depending on the package type: - * `.filebeat` for `.tar.gz` and `.tgz` archives + * `data/registry` for `.tar.gz` and `.tgz` archives * `/var/lib/filebeat/registry` for DEB and RPM packages * `c:\ProgramData\filebeat\registry` for the Windows zip file @@ -426,7 +426,7 @@ with the new packages. One notable change is the name of the registry file. The name varies depending on the package type: - * `.filebeat` for `.tar.gz` and `.tgz` archives + * `registry` for `.tar.gz` and `.tgz` archives * `/usr/lib/filebeat/registry` for DEB and RPM packages * `c:\ProgramData\filebeat\registry` for the Windows zip file diff --git a/filebeat/docs/reference/configuration/filebeat-options.asciidoc b/filebeat/docs/reference/configuration/filebeat-options.asciidoc index 0b2cd2ae794..9a8901775cf 100644 --- a/filebeat/docs/reference/configuration/filebeat-options.asciidoc +++ b/filebeat/docs/reference/configuration/filebeat-options.asciidoc @@ -390,13 +390,13 @@ filebeat: ===== registry_file -The name of the registry file. By default, the registry file is put in the current -working directory. If the working directory changes for subsequent runs of Filebeat, indexing starts from the beginning again. +The name of the registry file. If a relative path is used, it is considered relative to the +data path. The default is `registry`. [source,yaml] ------------------------------------------------------------------------------------- filebeat: - registry_file: .filebeat + registry_file: registry ------------------------------------------------------------------------------------- diff --git a/filebeat/etc/beat.yml b/filebeat/etc/beat.yml index bd92c850e1d..ee569ef269a 100644 --- a/filebeat/etc/beat.yml +++ b/filebeat/etc/beat.yml @@ -181,10 +181,9 @@ filebeat: # Flush even though spool_size is not reached. #idle_timeout: 5s - # Name of the registry file. Per default it is put in the current working - # directory. In case the working directory is changed after when running - # filebeat again, indexing starts from the beginning again. - #registry_file: .filebeat + # Name of the registry file. If a relative path is used, it is considered relative to the + # data path. + #registry_file: registry # Full Path to directory with additional prospector configuration files. Each file must end with .yml # These config files must have the full filebeat config part inside, but only diff --git a/filebeat/filebeat.yml b/filebeat/filebeat.yml index 8634eb676ef..1d82d8e8e80 100644 --- a/filebeat/filebeat.yml +++ b/filebeat/filebeat.yml @@ -181,10 +181,9 @@ filebeat: # Flush even though spool_size is not reached. #idle_timeout: 5s - # Name of the registry file. Per default it is put in the current working - # directory. In case the working directory is changed after when running - # filebeat again, indexing starts from the beginning again. - #registry_file: .filebeat + # Name of the registry file. If a relative path is used, it is considered relative to the + # data path. + #registry_file: registry # Full Path to directory with additional prospector configuration files. Each file must end with .yml # These config files must have the full filebeat config part inside, but only diff --git a/filebeat/input/file_test.go b/filebeat/input/file_test.go index e0cbce9f6db..a7891d52e4d 100644 --- a/filebeat/input/file_test.go +++ b/filebeat/input/file_test.go @@ -60,50 +60,50 @@ func TestSafeFileRotateExistingFile(t *testing.T) { assert.NoError(t, os.RemoveAll(tempdir)) }() - // create an existing .filebeat file - err = ioutil.WriteFile(filepath.Join(tempdir, ".filebeat"), + // create an existing registry file + err = ioutil.WriteFile(filepath.Join(tempdir, "registry"), []byte("existing filebeat"), 0x777) assert.NoError(t, err) - // create a new .filebeat.new file - err = ioutil.WriteFile(filepath.Join(tempdir, ".filebeat.new"), + // create a new registry.new file + err = ioutil.WriteFile(filepath.Join(tempdir, "registry.new"), []byte("new filebeat"), 0x777) assert.NoError(t, err) - // rotate .filebeat.new into .filebeat - err = SafeFileRotate(filepath.Join(tempdir, ".filebeat"), - filepath.Join(tempdir, ".filebeat.new")) + // rotate registry.new into registry + err = SafeFileRotate(filepath.Join(tempdir, "registry"), + filepath.Join(tempdir, "registry.new")) assert.NoError(t, err) - contents, err := ioutil.ReadFile(filepath.Join(tempdir, ".filebeat")) + contents, err := ioutil.ReadFile(filepath.Join(tempdir, "registry")) assert.NoError(t, err) assert.Equal(t, []byte("new filebeat"), contents) // do it again to make sure we deal with deleting the old file - err = ioutil.WriteFile(filepath.Join(tempdir, ".filebeat.new"), + err = ioutil.WriteFile(filepath.Join(tempdir, "registry.new"), []byte("new filebeat 1"), 0x777) assert.NoError(t, err) - err = SafeFileRotate(filepath.Join(tempdir, ".filebeat"), - filepath.Join(tempdir, ".filebeat.new")) + err = SafeFileRotate(filepath.Join(tempdir, "registry"), + filepath.Join(tempdir, "registry.new")) assert.NoError(t, err) - contents, err = ioutil.ReadFile(filepath.Join(tempdir, ".filebeat")) + contents, err = ioutil.ReadFile(filepath.Join(tempdir, "registry")) assert.NoError(t, err) assert.Equal(t, []byte("new filebeat 1"), contents) // and again for good measure - err = ioutil.WriteFile(filepath.Join(tempdir, ".filebeat.new"), + err = ioutil.WriteFile(filepath.Join(tempdir, "registry.new"), []byte("new filebeat 2"), 0x777) assert.NoError(t, err) - err = SafeFileRotate(filepath.Join(tempdir, ".filebeat"), - filepath.Join(tempdir, ".filebeat.new")) + err = SafeFileRotate(filepath.Join(tempdir, "registry"), + filepath.Join(tempdir, "registry.new")) assert.NoError(t, err) - contents, err = ioutil.ReadFile(filepath.Join(tempdir, ".filebeat")) + contents, err = ioutil.ReadFile(filepath.Join(tempdir, "registry")) assert.NoError(t, err) assert.Equal(t, []byte("new filebeat 2"), contents) } diff --git a/filebeat/tests/load/filebeat.yml b/filebeat/tests/load/filebeat.yml index 26f7cea3260..2df30ac223b 100644 --- a/filebeat/tests/load/filebeat.yml +++ b/filebeat/tests/load/filebeat.yml @@ -14,7 +14,7 @@ filebeat: spool_size: 4096 idle_timeout: 5s - registry_file: .filebeat + registry_file: registry ############################# Output ########################################## diff --git a/filebeat/tests/system/filebeat.py b/filebeat/tests/system/filebeat.py index 51dfd96f85d..a584cb0e234 100644 --- a/filebeat/tests/system/filebeat.py +++ b/filebeat/tests/system/filebeat.py @@ -15,7 +15,7 @@ def setUpClass(self): super(BaseTest, self).setUpClass() def get_registry(self): - # Returns content of the .filebeat file + # Returns content of the registry file dotFilebeat = self.working_dir + '/registry' assert os.path.isfile(dotFilebeat) is True diff --git a/libbeat/docs/shared-command-line.asciidoc b/libbeat/docs/shared-command-line.asciidoc index 87a38f4f681..af297eab626 100644 --- a/libbeat/docs/shared-command-line.asciidoc +++ b/libbeat/docs/shared-command-line.asciidoc @@ -39,6 +39,15 @@ Start http server for profiling. This option is useful for troubleshooting and p Write memory profile data to the specified output file. This option is useful for troubleshooting the Beat. +*`-path.config`*:: +Set the default location for configuration (e.g. the Elasticsearch template). + +*`-path.data`*:: +Set the default location for data files. + +*`-path.home`*:: +Set the default location for miscellaneous files. + *`-v`*:: Enable verbose output to show INFO-level messages.