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

Updated tracks tutorial to support Agent #143414

Merged
merged 13 commits into from
Nov 16, 2022
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Updated tutorial to support Elastic Agent
  • Loading branch information
jamesagarside committed Oct 15, 2022
commit 13303750d1902fcf04f080e6a8d4760b93da0e9d
58 changes: 25 additions & 33 deletions docs/maps/asset-tracking-tutorial.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ In this tutorial, you’ll look at live urban transit data from the city of Port

You’ll learn to:

- Use {filebeat} to ingest the TriMet REST API into Elasticsearch.
- Use the Elastic Agent to ingest the TriMet REST API into Elasticsearch.
- Create a map with layers that visualize asset tracks and last-known locations.
- Use symbols and colors to style data values and show which direction an asset is heading.
- Set up tracking containment alerts to monitor moving vehicles.
Expand All @@ -23,11 +23,11 @@ image::maps/images/asset-tracking-tutorial/construction_zones.png[]

- If you don’t already have {kib}, set it up with https://www.elastic.co/cloud/elasticsearch-service/signup?baymax=docs-body&elektra=docs[our free trial]. Download the deployment credentials.
- Obtain an API key for https://developer.trimet.org/[TriMet web services] at https://developer.trimet.org/appid/registration/.
- https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-installation-configuration.html[Install Filebeat].
- {fleet-guide}/fleet-overview.html[Fleet] is enabled on your cluster, and one or more {fleet-guide}/elastic-agent-installation.html[Elastic Agents] is enrolled.

[float]
=== Part 1: Ingest the Portland bus data
To get to the fun of visualizing and alerting on Portland buses, you must first create a {filebeat} input to ingest the TriMet Portland bus data into {es}.
To get to the fun of visualizing and alerting on Portland buses, you must first add the 'Custom API' integration to an Elastic Agent policy to get the TriMet Portland bus data into {es}.

[float]
==== Step 1: Set up an Elasticsearch index
Expand Down Expand Up @@ -270,47 +270,39 @@ PUT _ingest/pipeline/tri_met_tracks
----------------------------------

[float]
==== Step 2: Start {filebeat}
==== Step 2: Configure Elastic Agent

. Replace the contents in your `filebeat.yml` file with the following:
+
[source,yaml]
----------------------------------
filebeat.inputs:
# Fetch trimet bus data every minute.
- type: httpjson
interval: 1m
request.url: "https://developer.trimet.org/ws/v2/vehicles?appID=<tri_met_app_id>"
response.split:
target: body.resultSet.vehicle
processors:
- decode_json_fields:
fields: ["message"]
target: "trimet"
. From the {kib} main menu, click *Fleet*, then the *Agent policies* tab.

pipeline: "tri_met_tracks"
. Click the name of the agent policy where you want to add the *Custom API* integration to. The configuration changes you make only apply to the policy you select.

. Click the name of the *Custom API* integration, or add the integration first if the agent policy does not yet have it.

# ---------------------------- Elastic Cloud Output ----------------------------
cloud.id: <cloud_id>
cloud.auth: <username:password>
. From the *Edit Custom API integration* page, expand the *Change defaults* section.

----------------------------------
. Set the *Dataset name* to *httpjson.trimet*.

. Set the *Ingest Pipeline* to *tri_met_pipeline*.

. Replace `<tri_met_app_id>` with your TriMet application id.
. Replace `<username:password>` with your Elastic Cloud deployment credentials.
. Replace `<cloud_id>` with your {ece}/ece-cloud-id.html[elastic cloud id].
. Open a terminal window, and then navigate to the {filebeat} folder.
. In your `filebeat` folder, run {filebeat} with the edited config:
. Set the *Request URL* to *https://developer.trimet.org/ws/v2/vehicles?appID=<tri_met_app_id>*.

. Set *Response Split* to *target: body.resultSet.vehicle*.

. At the bottom of the configuration expand *Advanced options*.

. Set *Processors* to:
+
[source,bash]
[source,yaml]
----------------------------------
/bin/filebeat -c filebeat.yml
- decode_json_fields:
fields: ["message"]
target: "trimet"
----------------------------------

. Wait for {filebeat} to start shipping data to Elastic Cloud. {filebeat} should not produce any output to stdout.
. Leave everything else as defaults.

. Click *Save integration*, this will deploy the configuration to any Agents with the policy assigned.

. Leave the terminal window open and {filebeat} running throughout this tutorial.

[float]
==== Step 3: Create a data view for the tri_met_tracks {es} index
Expand Down