Skip to content

Directory layout and data path #1371

Closed
Closed
@tsg

Description

This a meta issue for the tasks required to support a "data path" in Beats.

The end goal is to have:

  • A clear location for the Filebeat/Winlogbeat registry files. This fixes the issue where the registry file was created in the home directory of the user.
  • Make it possible to load the template when running as a service in Windows. Fixes issue: Loading the template by default doesn't work on Windows when running as a serivce #1315
  • Provide a path for a persistent UUID, which we will need when implementing configuration management.
  • Have a clear location for storing the Kibana dashboards

The following configurable "paths" are introduced:

Description Default
path.home It’s the default folder for everything that doesn't fit in the categories before {binary directory}
path.data Contains things that are expected to change often during normal operations (“registry” files, UUID file, etc.) {path.home}/data
path.config Configuration file location {path.home}
path.logs Default path for log files. {path.home}/logs

This is modeled after Elasticsearch directory layout with some differences:

  • Not all path types are present. We might introduce more as we feel the need.
  • path.config has the same default as path.home. This is because in beats we don't have a config/ folder, and introducing one would be difficult because we have a config package.

Directory layouts

Illustrating these with Filebeat.

ZIP / TAR.GZ / TGZ

When running directly under the tarball archives, everything is relative to the binary location. This also matches the organization of the source code repository, so things should work the same when running from a source checkout.

    filebeat      
    filebeat.yml
    filebeat.template.json
    data/
       registry.json
       filebeat.uuid
    kibana/
      load.sh
      searches/
      visualisations/
      dashboards/
      index-patterns/

To run, you typically just start with: ./filebeat

DEB/RPM

Debian/Centos packages have their home path set to /usr/share/filebeat and their data path set to /var/lib/filebeat, to match current installations.

/usr/share/filebeat/
   bin/
     filebeat-god
     filebeat
   kibana/
        load.sh
        searches/
        visualisations/
        dashboards/
        index-patterns/
/etc/filebeat/
    filebeat.yml
    filebeat.template.json
/var/lib/filebeat/
    registry.json
    filebeat.uuid

The init scripts, start filebeat with:

   /usr/share/filebeat/filebeat --path.data /var/lib/filebeat
                                             --path.config /etc/filebeat/

The downside of moving the binary out of /usr/bin is that it gets a bit more complex to run in foreground from an installed system. This is because the binary is not in the system PATH anymore and because the data path and config paths need to be set correctly. We could mitigate this by providing a shell script in /usr/bin.

Windows

On Windows there are two options. Either run directly from the unzipped directory, in which case everything works as for the tar/zip case, or you install as a service. If you install as a service, the data path is set to c:\ProgramData\filebeat, so the we have the following structure:

{extractpath}/
   filebeat
   filebeat.template.json
   filebeat.yml
   dashboards/
        load.sh
        searches/
        visualisations/
c:\programdata\filebeat
   registry.json
   filebeat.uuid

The service will start filebeat with:

  $extractpath/filebeat -path.data c:\programdata\filebeat

This is not ideal yet, but matches pretty much what we have so far, fixes the automatic template loading and can be improved when we get a real Windows installer.

Required changes

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions