Skip to content

New subcommand: generate#6912

Closed
kvch wants to merge 4 commits intoelastic:masterfrom
kvch:feature/libbeat/new-subcommand-generate
Closed

New subcommand: generate#6912
kvch wants to merge 4 commits intoelastic:masterfrom
kvch:feature/libbeat/new-subcommand-generate

Conversation

@kvch
Copy link
Copy Markdown
Contributor

@kvch kvch commented Apr 20, 2018

A new subcommand is added named generate to all Beats. This command has a few more subcommands in case of Filebeat.

Motivation

This is the next baby step to removing Python from make update and making it possible for all users without development envs to generate files, if they edited something locally (including generating FB module).

Subcommands in case of all Beats (e.g. Metricbeat):

$ ./metricbeat generate -h
Generate files for Metricbeat

Usage:
  metricbeat generate [command]

Available Commands:
  global-fields        Generate global fields.yml for Metricbeat
  kibana-index-pattern Generate Kibana index pattern for Metricbeat

Flags:
      --beats_path string    (default "..")
  -h, --help                help for generate

Subcommands of generate:

  1. global-fields: The existing fields.yml collector is ported to Golang and is unified for all Beats. The behaviour is not changed. The collected fields.yml files are concatenated into one global fields.yml and placed under _meta.
  2. kibana-index-pattern: The existing Golang script is exposed as a subcommand.

Subcommands of Filebeat:

$ ./filebeat generate -h
Generate files for Filebeat

Usage:
  filebeat generate [command]

Available Commands:
  fields               Generate fields.yml for a fileset
  fileset              Generate a new Filebeat fileset
  global-fields        Generate global fields.yml for Filebeat
  kibana-index-pattern Generate Kibana index pattern for Filebeat
  module               Generate a new Filebeat module

Flags:
      --beats_path string    (default "..")
  -h, --help                help for generate

Special subcommands of Filebeat:

  1. fields: Existing script is exposed.
  2. fileset: Existing script is exposed.
  3. module: Existing script is exposed.

Misc additions

  • Main logic of Filebeat generators is moved to filebeat/generator from filebeat/scripts/generator
  • Remove an unnecessary param from subcommands of keystore
  • Fix tyop in Kibana index pattern

TODO

  • refactor Kibana index pattern generator
  • more verbose help

Depends on: #6911

@kvch kvch added in progress Pull request is currently in progress. review Filebeat Filebeat libbeat labels Apr 20, 2018
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function Generate should have comment or be unexported

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type YmlFile should have comment or be unexported

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment on exported method Beat.GenerateGlobalFields should be of the form "GenerateGlobalFields ..."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported var BeatsPath should have comment or be unexported

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error strings should not be capitalized or end with punctuation or a newline

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error strings should not be capitalized or end with punctuation or a newline

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error strings should not be capitalized or end with punctuation or a newline

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function Generate should have comment or be unexported

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error strings should not be capitalized or end with punctuation or a newline

@kvch kvch removed the review label May 14, 2018
@kvch kvch force-pushed the feature/libbeat/new-subcommand-generate branch from 16b848e to 74dd3ea Compare July 3, 2018 15:36
@kvch kvch force-pushed the feature/libbeat/new-subcommand-generate branch from 619b9e8 to 789170a Compare July 3, 2018 16:03
@kvch
Copy link
Copy Markdown
Contributor Author

kvch commented Jul 3, 2018

I rebased the PR. But it still has a few minor problems, before it becomes ready to review.

@kvch
Copy link
Copy Markdown
Contributor Author

kvch commented Jan 16, 2019

Closing in favour of #9314

@kvch kvch closed this Jan 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Filebeat Filebeat in progress Pull request is currently in progress. libbeat

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants