Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ingest Manager] Basic Elastic Agent documentation #19030

Merged
merged 50 commits into from
Jun 10, 2020
Merged
Changes from 2 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
846b029
docs
michalpristas Jun 7, 2020
4135449
relative links
michalpristas Jun 8, 2020
66bd030
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
9d7aee1
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
f6a4a7d
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
f2673e0
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
0003890
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
f0a9dc1
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
de8baa4
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
250e8e7
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
ce87631
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
b2d2657
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
84c2ea9
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
d321304
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
d6197fa
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
90f0980
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
780c4aa
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
c5522a4
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
8e6ea52
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
96a3ff5
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
4cc6312
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
1950232
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
1bc2c22
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
371d8ed
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
d946757
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
c7e162b
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
62bc73f
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
1fa71f1
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
5fd8923
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
87266ad
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
75b43c7
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
d210096
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
4e2221d
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
335ebe8
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
67d1877
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
6e6a4ab
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
4abc7f8
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
cd875fd
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
f17b3f3
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
bf55bf6
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
97c416b
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
c6a499e
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
7539961
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
71a5e81
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 9, 2020
69c6e23
wip
michalpristas Jun 9, 2020
8a437af
default behavior notice
michalpristas Jun 9, 2020
37cab7b
Update x-pack/elastic-agent/docs/elastic-agent.asciidoc
michalpristas Jun 10, 2020
683fe89
step1
michalpristas Jun 10, 2020
816e5b0
Merge branch 'agent-first-docs' of github.com:michalpristas/beats int…
michalpristas Jun 10, 2020
d53710b
mod
michalpristas Jun 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
333 changes: 255 additions & 78 deletions x-pack/elastic-agent/docs/elastic-agent.asciidoc
Original file line number Diff line number Diff line change
@@ -1,78 +1,255 @@
Agent's notes


[[requirements]]
Requirements

The remote Kibana version of the Agent must be equal or higher than the Agent version, if this is not met

Choose a reason for hiding this comment

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

@michalpristas I think the requirement is that the Agent must be equal or higher than the Agent minor version. I think we are still able to make patch releases for Agent without updating the whole stack. Can you confirm?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we removed sending kbn-version as there was a check on kibana side which required it to be == when sent. not sure what the status of the check is atm cc @nchaulet

Kibana will refuse the connection.


[[Supported Actions by the Agent]]

The Elastic Agent supports the following actions received by Fleet.

Implemented:

[[Configuration change]]

The Elastic Agent receives a configuration encoded as a JSON object.

[source,json]
------------------------------------------------------------------------------
{
"type": "CONFIG_CHANGE",
"id": "id1",
"data": {
"config": {
"id": "policy-id",
"outputs": {
"default": {
"hosts": "https://localhost:9200"
}
},
"datasources": [{
"id": "string",
"enabled": true,
"use_output": "default",
"inputs": [{
"type": "logs",
"streams": [{
"paths": ["/var/log/hello.log"]
}]
}]
}]
}
}
}
------------------------------------------------------------------------------

[[Planned but not implemented]]

[source,json]
------------------------------------------------------------------------------
{
"type": "UPGRADE",
"id": "id1",
"target_version": "7.2.1"
}
------------------------------------------------------------------------------

[source,json]
------------------------------------------------------------------------------
{
"type": "DOWNGRADE",
"id": "id1",
"target_version": "7.2.1"
}
------------------------------------------------------------------------------

[source,json]
------------------------------------------------------------------------------
{
"type": "RELAY",
"id": "id1",
"destination": {"name":"endpoint"}
"data": {}
}
------------------------------------------------------------------------------
[[elastic-agent-getting-started]]
== Get started with {beatname_uc}

++++
<titleabbrev>Get started</titleabbrev>
++++

== What is Elastic Agent


Elastic Agent is single, unified agent that users can deploy to hosts or containers. Based on configuration provided, it controls which data is collected from the host or containers and where the data is sent. It will run Beats or Endpoint as needed.

* <<elastic-agent-installation>>
* <<elastic-agent-execution-modes>>
* <<elastic-agent-cmd-options>>
* <<elastic-agent-configuration>>

[[elastic-agent-installation]]
== Installation

=== Step 1: Download Elastic Agent

See our https://www.elastic.co/downloads/beats/{beatname_lc}[download page] for
Copy link
Contributor

Choose a reason for hiding this comment

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

I would say something like:

Download the package from the https://www.elastic.co/downloads/beats/{beatname_lc}[download page].

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that if you use {beatname_lc}, you'll need to set the attribute somewhere (probably in the index file)

:beatname_lc: value

Might make sense to create a new attribute for agent, tho

other installation options, such as 32-bit images.

=== Step 2: Unpack archive


[[mac]]
*mac:*

ifeval::["{release-state}"=="unreleased"]

Version {version} of {beatname_uc} has not yet been released.

endif::[]

ifeval::["{release-state}"!="unreleased"]

["source","sh",subs="attributes,callouts"]
------------------------------------------------
curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-{version}-darwin-x86_64.tar.gz
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit odd to have step 1 and the curl command. I'd choose one or the other, not both.

tar xzvf elastic-agent-{version}-darwin-x86_64.tar.gz
------------------------------------------------

endif::[]

[[linux]]
*linux:*

ifeval::["{release-state}"=="unreleased"]

Version {version} of {beatname_uc} has not yet been released.

endif::[]

ifeval::["{release-state}"!="unreleased"]

["source","sh",subs="attributes,callouts"]
------------------------------------------------
curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-{version}-linux-x86_64.tar.gz
tar xzvf elastic-agent-{version}-linux-x86_64.tar.gz
------------------------------------------------

endif::[]

[[win]]
*win:*

ifeval::["{release-state}"=="unreleased"]

Version {version} of {beatname_uc} has not yet been released.

endif::[]

ifeval::["{release-state}"!="unreleased"]

. Download the Elastic Agent Windows zip file from the
https://www.elastic.co/downloads/beats/elastic-agent[downloads page].

. Extract the contents of the zip file into `C:\Program Files`.

. Rename the `elastic-agent-<version>-windows` directory to `Elastic-Agent`.

. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select *Run As Administrator*).

. From the PowerShell prompt, run the following commands to install Filebeat as a
Windows service:
+
[source,shell]
----------------------------------------------------------------------
PS > cd 'C:\Program Files\Elastic-Agent'
PS C:\Program Files\Elastic-Agent> .\install-service-elastic-agent.ps1
----------------------------------------------------------------------

NOTE: If script execution is disabled on your system, you need to set the execution policy for the current session to allow the script to run. For example: `PowerShell.exe -ExecutionPolicy UnRestricted -File .\install-service-elastic-agent.ps1`.

endif::[]

=== Step 3: Run Elastic Agent

If Elastic Agent is not installed as an auto-starting service it is possible to start in manually running.


[source,shell]
----------------------------------------------------------------------
$ ./elastic-agent run
----------------------------------------------------------------------

[[elastic-agent-execution-modes]]
== Execution modes

Elastic Agent is capable of running in two modes: standalone or fleet. Difference between these is in a way how where agent is configured and managed.

=== Standalone mode

With standalone mode agent is configured locally and managed manually. Each agent is configured to be in this mode by default after installation.
Elastic Agent reads configuration file provided by `-c` argument while agent is being started or uses a default configuration located in the same directory called `elastic-agent.yml`.

For configuration options see link:elastic-agent_configuration_example.yml[Elastic Agent Configuration Example]
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this path will resolve correctly in the html. Where will this file live? You need to specify a path. link: is not required.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

referring to a file which sits beside this one in a repo. i hoped it gets copied as is and relative link will be resolved correctly


=== Fleet mode

With fleet mode agent is managed remotely. It uses trusted kibana instance with enabled _Ingest Manager_ and _Fleet_ to retrieve configurations from and report any agent events to.

Process of creating trusted communication channel between _Elastic Agent_ and _Kibana_ is called `enrolling an agent`.

To enroll an _Elastic Agent_ to _Fleet_ agent provides an `enroll` command.


[NOTE]
==============
Agent needs to be stopped before executing enroll command.
==============

Enrolling an agent look like following:

[source,shell]
----------------------------------------------------------------------
$ ./elastic-agent http://localhost:5601 $token
----------------------------------------------------------------------

`$token` is an Enrollment token acquired from fleet.

[[elastic-agent-cmd-options]]
== Command line options

`elastic-agent run` commands provides few flags which can alter the behavior of an agent.

==== `-path.home`

Specifies home directory of an agent. `path.home` is used for determining location of configuration file or data directory.

==== `-c`

This flags specifies configuration file to load.
If this is omitted elastic agent uses `{path.home}/elastic-agent.yml`.


==== `-path.data`

Data directory is used by agent to store downloaded artifacts and as a place where logs generated by Beats started and managed by the agent are written.

If not specified `{path.home}/data` is used.

[[elastic-agent-configuration]]
== Configuring Elastic Agent

By default Elastic Agent is configured to run in a standalone mode ingesting system data and sending them to local Elasticsearch on port 9200 with demo credentials of `elastic` user. It's also configured to monitor behavior of managed Beats in a form of tracking their logs and metrics and sending them to the same Elasticsearch instance.

To alter this behavior user has following options:

=== Configuring output

Elastic Agent enables definition of multiple outputs where each data source can be paired with different output.
Copy link
Contributor

@dedemorton dedemorton Jun 8, 2020

Choose a reason for hiding this comment

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

I think we can say this more concisely. How about:

Define one or more outputs. You can pair each data source with a different output. For example:

There are still a couple of problems with this. Will users know what a data source is? What do you mean by pairing?

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry, my comment had some typos. Fixed. :-P


E.g
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
E.g

Copy link
Contributor

Choose a reason for hiding this comment

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

No need for this...just introduce the example in the lead-in sentence.

[source,yaml]
-------------------------------------------------------------------------------------
outputs:
default:
type: elasticsearch
hosts: [127.0.0.1:9200]
username: elastic
password: changeme

monitoring:
type: elasticsearch
api_key: VuaCfGcBCdbkQm-e5aOx:ui2lp2axTNmsyakw9tvNnw
hosts: ["localhost:9200"]
ca_sha256: "7lHLiyp4J8m9kw38SJ7SURJP4bXRZv/BNxyyXkCcE/M="
-------------------------------------------------------------------------------------

In the example above 2 outputs are provided. One called `default` and one called `monitoring`.
Difference between them is in authentication method they are using, while first one uses username password pair second one contains api key.

[NOTE]
==============
Configuration is invalid without definition of default output
==============

=== Enable/Disable Beats monitoring

To disable or enable monitoring of managed Beats following section is available:

[source,yaml]
-------------------------------------------------------------------------------------
settings.monitoring:
# enabled turns on monitoring of running processes
enabled: true
# enables log monitoring
logs: true
# enables metrics monitoring
metrics: true
# specifies output to be used
use_output: monitoring
-------------------------------------------------------------------------------------


In case `settings.monitoring.enabled` is set to `false` monitoring of Beats is turned on and other options are ignored.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you mean that it's turned off. Also I think this section needs to be easier to scan. I'll recommend edits to fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yes thanks for notice

If `settings.monitoring.enabled` is set to `true` Elastic Agent watches Metrics or Logs of Beats according to `settings.monitoring.metrics` or `settings.monitoring.logs` values.

Having both set to `false` results in the same behavior as disabling monitoring.

`use_output` option specifies output to which events will be send.

=== Specifying data sources

By default Elastic Agent ingests some system metrics. Its default configuration can look like this:


[source,yaml]
-------------------------------------------------------------------------------------
datasources:
- namespace: default
use_output: default
inputs:
- type: system/metrics
streams:
- metricset: cpu
dataset: system.cpu
- metricset: memory
dataset: system.memory
- metricset: network
dataset: system.network
- metricset: filesystem
dataset: system.filesystem
-------------------------------------------------------------------------------------

This configuration configures gathering cpu, memory, network and filesystem metrics and sending them to default output.
If `use_output` option is not specified, output called `default` is used.

For more examples please refer to link:elastic-agent_configuration_example.yml[Elastic Agent Configuration Example]