Skip to content

Commit

Permalink
Replaced all occurrences of .filebeat
Browse files Browse the repository at this point in the history
  • Loading branch information
Tudor Golubenco committed Apr 13, 2016
1 parent 04d1ea8 commit 2023850
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 32 deletions.
2 changes: 1 addition & 1 deletion filebeat/crawler/registrar.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions filebeat/docs/migration.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------------------------------------------------------------------------------


Expand Down
7 changes: 3 additions & 4 deletions filebeat/etc/beat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions filebeat/filebeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 16 additions & 16 deletions filebeat/input/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion filebeat/tests/load/filebeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ filebeat:

spool_size: 4096
idle_timeout: 5s
registry_file: .filebeat
registry_file: registry


############################# Output ##########################################
Expand Down
2 changes: 1 addition & 1 deletion filebeat/tests/system/filebeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions libbeat/docs/shared-command-line.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 2023850

Please sign in to comment.