-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathexample-standalone-monitor-nginx-serverless.html
655 lines (632 loc) · 39.5 KB
/
example-standalone-monitor-nginx-serverless.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="UTF-8">
<title>Example: Use standalone Elastic Agent with Elastic Cloud Serverless to monitor nginx | Fleet and Elastic Agent Guide [8.18] | Elastic</title>
<meta class="elastic" name="content" content="Example: Use standalone Elastic Agent with Elastic Cloud Serverless to monitor nginx | Fleet and Elastic Agent Guide [8.18]">
<link rel="home" href="index.html" title="Fleet and Elastic Agent Guide [8.18]"/>
<link rel="up" href="elastic-agent-configuration.html" title="Configure standalone Elastic Agents"/>
<link rel="prev" href="grant-access-to-elasticsearch.html" title="Grant standalone Elastic Agents access to Elasticsearch"/>
<link rel="next" href="example-standalone-monitor-nginx.html" title="Example: Use standalone Elastic Agent with Elasticsearch Service to monitor nginx"/>
<meta class="elastic" name="product_version" content="8.18"/>
<meta class="elastic" name="product_name" content="Fleet and Elastic Agent"/>
<meta class="elastic" name="website_area" content="documentation"/>
<meta name="DC.type" content="Learn/Docs/Fleet/Guide/Elastic Agent/8.18"/>
<meta name="DC.subject" content="Fleet and Elastic Agent"/>
<meta name="DC.identifier" content="8.18"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.optimizely.com/js/18132920325.js"></script>
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="/manifest.json">
<meta name="apple-mobile-web-app-title" content="Elastic">
<meta name="application-name" content="Elastic">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/mstile-144x144.png">
<meta name="theme-color" content="#ffffff">
<meta name="naver-site-verification" content="936882c1853b701b3cef3721758d80535413dbfd" />
<meta name="yandex-verification" content="d8a47e95d0972434" />
<meta name="localized" content="true" />
<meta name="st:robots" content="follow,index" />
<meta property="og:image" content="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt280217a63b82a734/6202d3378b1f312528798412/elastic-logo.svg" />
<meta property="og:image:width" content="500" />
<meta property="og:image:height" content="172" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon-precomposed" sizes="64x64" href="/favicon_64x64_16bit.png">
<link rel="apple-touch-icon-precomposed" sizes="32x32" href="/favicon_32x32.png">
<link rel="apple-touch-icon-precomposed" sizes="16x16" href="/favicon_16x16.png">
<!-- Give IE8 a fighting chance -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/guide/static/styles-v1.css" />
</head>
<!--© 2015-2025 Elasticsearch B.V. -->
<!-- All Elastic documentation is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. -->
<!-- http://creativecommons.org/licenses/by-nc-nd/4.0/ -->
<body>
<!-- Google Tag Manager -->
<script>dataLayer = [];</script><noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-58RLH5" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-58RLH5');</script>
<!-- End Google Tag Manager -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-12395217-16"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-12395217-16');
</script>
<!-- Google Tag Manager for GA4 -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-KNJMG2M');</script>
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KNJMG2M" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager for GA4-->
<div id='elastic-nav' style="display:none;"></div>
<script src='https://www.elastic.co/elastic-nav.js'></script>
<div class="main-container">
<section id="content" >
<div class="content-wrapper">
<section id="guide" lang="en">
<div class="container-fluid">
<div class="row pb-3">
<div class="col-12 order-2 col-md-4 order-md-1 col-lg-3 h-almost-full-md sticky-top-md" id="left_col">
<!-- The TOC is appended here -->
</div>
<div class="col-12 order-1 col-md-8 order-md-2 col-lg-7 order-lg-2 guide-section" id="middle_col">
<!-- start body -->
<div class="navheader">
<span class="prev">
<a href="grant-access-to-elasticsearch.html">« Grant standalone Elastic Agents access to Elasticsearch</a>
</span>
<span class="next">
<a href="example-standalone-monitor-nginx.html">Example: Use standalone Elastic Agent with Elasticsearch Service to monitor nginx »</a>
</span>
</div>
<div class="book" lang="en">
<div class="titlepage">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="/guide/">Elastic Docs</a></span>
<span class="chevron-right">›</span><span class="breadcrumb-link"><a href="index.html">Fleet and Elastic Agent Guide [8.18]</a></span>
<span class="chevron-right">›</span><span class="breadcrumb-link"><a href="elastic-agent-configuration.html">Configure standalone Elastic Agents</a></span>
</div>
<div>
<div><h1 class="title"><a id="id-1"></a>Example: Use standalone Elastic Agent with Elastic Cloud Serverless to monitor nginx</h1><a class="edit_me" rel="nofollow" title="Edit this page on GitHub" href="https://github.com/elastic/ingest-docs/edit/8.18/docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-serverless.asciidoc">edit</a></div>
</div>
<!--EXTRA-->
</div>
<div id="content">
<div id="url-to-v3" class="version-warning">
A newer version is available. Check out the <a href="https://www.elastic.co/docs/reference/fleet/example-standalone-monitor-nginx-serverless">latest documentation</a>.
</div>
<div class="section">
<div class="titlepage"><div><div>
<div class="position-relative"><h2 class="title"><a id="example-standalone-monitor-nginx-serverless"></a>Example: Use standalone Elastic Agent with Elastic Cloud Serverless to monitor nginx</h2><a class="edit_me" rel="nofollow" title="Edit this page on GitHub" href="https://github.com/elastic/ingest-docs/edit/8.18/docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-serverless.asciidoc">edit</a></div>
</div></div></div>
<p>This guide walks you through a simple monitoring scenario so you can learn the basics of setting up standalone Elastic Agent, using it to work with Elastic Cloud Serverless and an Elastic integration.</p>
<p>Following these steps, you’ll deploy the Elastic Stack, install a standalone Elastic Agent on a host to monitor an nginx web server instance, and access visualizations based on the collected logs.</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
<a class="xref" href="example-standalone-monitor-nginx-serverless.html#nginx-guide-install-nginx-serverless" title="Step 1: Install nginx">Install nginx</a>.
</li>
<li class="listitem">
<a class="xref" href="example-standalone-monitor-nginx-serverless.html#nginx-guide-sign-up-serverless" title="Step 2: Create an Elastic Cloud Serverless project">Create an Elastic Cloud Serverless project</a>.
</li>
<li class="listitem">
<a class="xref" href="example-standalone-monitor-nginx-serverless.html#nginx-guide-create-api-key-serverless" title="Step 3: Create an Elasticsearch API key">Create an API key</a>.
</li>
<li class="listitem">
<a class="xref" href="example-standalone-monitor-nginx-serverless.html#nginx-guide-create-policy-serverless" title="Step 4: Create an Elastic Agent policy">Create an Elastic Agent policy</a>.
</li>
<li class="listitem">
<a class="xref" href="example-standalone-monitor-nginx-serverless.html#nginx-guide-add-integration-serverless" title="Step 5: Add the Nginx Integration">Add the Nginx Integration</a>.
</li>
<li class="listitem">
<a class="xref" href="example-standalone-monitor-nginx-serverless.html#nginx-guide-configure-standalone-agent-serverless" title="Step 6: Configure standalone Elastic Agent">Configure standalone Elastic Agent</a>.
</li>
<li class="listitem">
<a class="xref" href="example-standalone-monitor-nginx-serverless.html#nginx-guide-confirm-agent-data-serverless" title="Step 7: Confirm that your Elastic Agent data is flowing">Confirm that your Elastic Agent data is flowing</a>.
</li>
<li class="listitem">
<a class="xref" href="example-standalone-monitor-nginx-serverless.html#nginx-guide-view-system-data-serverless" title="Step 8: View your system data">View your system data</a>.
</li>
<li class="listitem">
<a class="xref" href="example-standalone-monitor-nginx-serverless.html#nginx-guide-view-nginx-data-serverless" title="Step 9: View your nginx logging data">View your nginx logging data</a>.
</li>
</ol>
</div>
<div class="position-relative"><h5><a id="nginx-guide-prereqs-serverless"></a>Prerequisites</h5><a class="edit_me" rel="nofollow" title="Edit this page on GitHub" href="https://github.com/elastic/ingest-docs/edit/8.18/docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-serverless.asciidoc">edit</a></div>
<p>To get started, you need:</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
An internet connection and an email address for your Elastic Cloud trial.
</li>
<li class="listitem">
A Linux host machine on which you’ll install an nginx web server. The commands in this guide use an Ubuntu image but any Linux distribution should be fine.
</li>
</ol>
</div>
<div class="position-relative"><h5><a id="nginx-guide-install-nginx-serverless"></a>Step 1: Install nginx</h5><a class="edit_me" rel="nofollow" title="Edit this page on GitHub" href="https://github.com/elastic/ingest-docs/edit/8.18/docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-serverless.asciidoc">edit</a></div>
<p>To start, we’ll set up a basic <a href="https://docs.nginx.com/nginx/admin-guide/web-server/" class="ulink" target="_top">nginx web server</a>.</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
<p>Run the following command on an Ubuntu Linux host, or refer to the <a href="https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/" class="ulink" target="_top">nginx install documentation</a> for the command appropriate to your operating system.</p>
<div class="pre_wrapper lang-sh">
<div class="console_code_copy" title="Copy to clipboard"></div>
<pre class="programlisting prettyprint lang-sh">sudo apt install nginx</pre>
</div>
</li>
<li class="listitem">
<p>Open a web browser and visit your host machine’s external URL, for example <code class="literal">http://192.168.64.17/</code>. You should see the nginx welcome message.</p>
<div class="imageblock screenshot">
<div class="content">
<img src="images/guide-nginx-welcome.png" alt="Browser window showing Welcome to nginx!">
</div>
</div>
</li>
</ol>
</div>
<div class="position-relative"><h5><a id="nginx-guide-sign-up-serverless"></a>Step 2: Create an Elastic Cloud Serverless project</h5><a class="edit_me" rel="nofollow" title="Edit this page on GitHub" href="https://github.com/elastic/ingest-docs/edit/8.18/docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-serverless.asciidoc">edit</a></div>
<div class="note admon">
<div class="icon"></div>
<div class="admon_content">
<p>If you’ve already signed up for a trial deployment you can skip this step.</p>
</div>
</div>
<p>Now that your web server is running, let’s get set up to monitor it in Elastic Cloud. An Elastic Cloud Serverless project offers you all of the features of the Elastic Stack as a hosted service. To test drive your first deployment, sign up for a free Elastic Cloud trial:</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
Go to our <a href="https://cloud.elastic.co/registration?elektra=guide-welcome-cta" class="ulink" target="_top">Elastic Cloud Trial</a> page.
</li>
<li class="listitem">
<p>Enter your email address and a password.</p>
<div class="imageblock screenshot">
<div class="content">
<img src="images/guide-sign-up-trial.png" alt="Start your free Elastic Cloud trial" width="50%">
</div>
</div>
</li>
<li class="listitem">
After you’ve <a href="https://cloud.elastic.co/login" class="ulink" target="_top">logged in</a>, select <span class="strong strong"><strong>Create project</strong></span>.
</li>
<li class="listitem">
On the <span class="strong strong"><strong>Observability</strong></span> tab, select <span class="strong strong"><strong>Next</strong></span>. The <span class="strong strong"><strong>Observability</strong></span> and <span class="strong strong"><strong>Security</strong></span> projects both include Fleet, which you can use to create a policy for the Elastic Agent that will monitor your nginx installation.
</li>
<li class="listitem">
Give your project a name. You can leave the default options or select a different cloud provider and region.
</li>
<li class="listitem">
Select <span class="strong strong"><strong>Create project</strong></span>, and then wait a few minutes for the new project to set up.
</li>
<li class="listitem">
Once the project is ready, select <span class="strong strong"><strong>Continue</strong></span>. At this point, you access Kibana and a selection of setup guides.
</li>
</ol>
</div>
<div class="position-relative"><h5><a id="nginx-guide-create-api-key-serverless"></a>Step 3: Create an Elasticsearch API key</h5><a class="edit_me" rel="nofollow" title="Edit this page on GitHub" href="https://github.com/elastic/ingest-docs/edit/8.18/docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-serverless.asciidoc">edit</a></div>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
When your Serverless project is ready, open the Kibana menu and go to <span class="strong strong"><strong>Project settings</strong></span> → <span class="strong strong"><strong>Management → API keys</strong></span>.
</li>
<li class="listitem">
Select <span class="strong strong"><strong>Create API key</strong></span>.
</li>
<li class="listitem">
Give the key a name, for example <code class="literal">nginx example API key</code>.
</li>
<li class="listitem">
Leave the other default options and select <span class="strong strong"><strong>Create API key</strong></span>.
</li>
<li class="listitem">
In the <span class="strong strong"><strong>Create API key</strong></span> confirmation dialog, change the dropdown menu setting from <code class="literal">Encoded</code> to <code class="literal">Beats</code>. This sets the API key to the format used for communication between Elastic Agent and Elasticsearch.
</li>
<li class="listitem">
Copy the generated API key and store it in a safe place. You’ll use it in a later step.
</li>
</ol>
</div>
<div class="position-relative"><h5><a id="nginx-guide-create-policy-serverless"></a>Step 4: Create an Elastic Agent policy</h5><a class="edit_me" rel="nofollow" title="Edit this page on GitHub" href="https://github.com/elastic/ingest-docs/edit/8.18/docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-serverless.asciidoc">edit</a></div>
<p>Elastic Agent is a single, unified way to add monitoring for logs, metrics, and other types of data to a host. It can also protect hosts from security threats, query data from operating systems, and more. A single agent makes it easy and fast to deploy monitoring across your infrastructure. Each agent has a single policy (a collection of input settings) that you can update to add integrations for new data sources, security protections, and more.</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
<p>Open the Kibana menu and go to <span class="strong strong"><strong>Project settings</strong></span> → <span class="strong strong"><strong>Fleet → Agent policies</strong></span>.</p>
<div class="imageblock">
<div class="content">
<img src="images/guide-agent-policies.png" alt="Agent policies tab in Fleet">
</div>
</div>
</li>
<li class="listitem">
Click <span class="strong strong"><strong>Create agent policy</strong></span>.
</li>
<li class="listitem">
Give your policy a name. For this example we’ll call it <code class="literal">nginx-policy</code>.
</li>
<li class="listitem">
Leave <span class="strong strong"><strong>Collect system logs and metrics</strong></span> selected.
</li>
<li class="listitem">
<p>Click <span class="strong strong"><strong>Create agent policy</strong></span>.</p>
<div class="imageblock">
<div class="content">
<img src="images/guide-create-agent-policy.png" alt="Create agent policy UI">
</div>
</div>
</li>
</ol>
</div>
<div class="position-relative"><h5><a id="nginx-guide-add-integration-serverless"></a>Step 5: Add the Nginx Integration</h5><a class="edit_me" rel="nofollow" title="Edit this page on GitHub" href="https://github.com/elastic/ingest-docs/edit/8.18/docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-serverless.asciidoc">edit</a></div>
<p>Elastic integrations are a streamlined way to connect your data from popular services and platforms to the Elastic Stack, including nginx.</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
<p>From the <span class="strong strong"><strong>Fleet → Agent policies</strong></span> tab, click the link for your new <code class="literal">nginx-policy</code>.</p>
<div class="imageblock">
<div class="content">
<img src="images/guide-nginx-policy.png" alt="The nginx-policy UI with integrations tab selected">
</div>
</div>
</li>
<li class="listitem">
Note that the System integration (<code class="literal">system-1</code>) is included because you opted earlier to collect system logs and metrics.
</li>
<li class="listitem">
Click <span class="strong strong"><strong>Add integration</strong></span>.
</li>
<li class="listitem">
<p>On the Integrations page search for "nginx".</p>
<div class="imageblock">
<div class="content">
<img src="images/guide-integrations-page.png" alt="Integrations page with nginx in the search bar">
</div>
</div>
</li>
<li class="listitem">
Select the <span class="strong strong"><strong>Nginx</strong></span> card.
</li>
<li class="listitem">
Click <span class="strong strong"><strong>Add Nginx</strong></span>.
</li>
<li class="listitem">
Click the link to <span class="strong strong"><strong>Add integration only (skip agent installation)</strong></span>. You’ll install standalone Elastic Agent in a later step.
</li>
<li class="listitem">
<p>Here, you can select options such as the paths to where your nginx logs are stored, whether or not to collect metrics data, and various other settings.</p>
<p>For now, leave all of the default settings and click <span class="strong strong"><strong>Save and continue</strong></span> to add the Nginx integration to your <code class="literal">nginx-policy</code> policy.</p>
<div class="imageblock">
<div class="content">
<img src="images/guide-add-nginx-integration.png" alt="Add Nginx Integration UI">
</div>
</div>
</li>
<li class="listitem">
<p>In the confirmation dialog, select to <span class="strong strong"><strong>Add Elastic Agent later</strong></span>.</p>
<div class="imageblock">
<div class="content">
<img src="images/guide-nginx-integration-added.png" alt="Nginx Integration added confirmation UI with Add Elastic Agent later selected.">
</div>
</div>
</li>
</ol>
</div>
<div class="position-relative"><h5><a id="nginx-guide-configure-standalone-agent-serverless"></a>Step 6: Configure standalone Elastic Agent</h5><a class="edit_me" rel="nofollow" title="Edit this page on GitHub" href="https://github.com/elastic/ingest-docs/edit/8.18/docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-serverless.asciidoc">edit</a></div>
<p>Rather than opt for Fleet to centrally manage Elastic Agent, you’ll configure an agent to run in standalone mode, so it will be managed by hand.</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
Open the Kibana menu and go to <span class="strong strong"><strong>Fleet → Agents</strong></span> and click <span class="strong strong"><strong>Add agent</strong></span>.
</li>
<li class="listitem">
For the <span class="strong strong"><strong>What type of host are you adding?</strong></span> step, select <code class="literal">nginx-policy</code> from the drop-down menu if it’s not already selected.
</li>
<li class="listitem">
<p>For the <span class="strong strong"><strong>Enroll in Fleet?</strong></span> step, select <span class="strong strong"><strong>Run standalone</strong></span>.</p>
<div class="imageblock">
<div class="content">
<img src="images/guide-add-agent-standalone01.png" alt="Add agent UI with nginx-policy and Run-standalone selected.">
</div>
</div>
</li>
<li class="listitem">
<p>For the <span class="strong strong"><strong>Configure the agent</strong></span> step, choose <span class="strong strong"><strong>Download Policy</strong></span>. Save the <code class="literal">elastic-agent.yml</code> file to a directory on the host where you’ll install nginx for monitoring.</p>
<p>Have a look inside the policy file and notice that it contains all of the input, output, and other settings for the Nginx and System integrations. If you already have a standalone agent installed on a host with an existing Elastic Agent policy, you can use the method described here to add a new integration. Just add the settings from the <span class="strong strong"><strong>Configure the agent</strong></span> step to your existing <code class="literal">elastic-agent.yml</code> file.</p>
</li>
<li class="listitem">
<p>For the <span class="strong strong"><strong>Install Elastic Agent on your host</strong></span> step, select the tab for your host operating system and run the commands on your host.</p>
<div class="imageblock">
<div class="content">
<img src="images/guide-install-agent-on-host.png" alt="Install Elastic Agent on your host step, showing tabs with the commands for different operating systems.">
</div>
</div>
<div class="note admon">
<div class="icon"></div>
<div class="admon_content">
<p>Elastic Agent commands should be run as <code class="literal">root</code>. You can prefix each agent command with <code class="literal">sudo</code> or you can start a new shell as <code class="literal">root</code> by running <code class="literal">sudo su</code>. If you need to run Elastic Agent commands without <code class="literal">root</code> access, refer to <a class="xref" href="elastic-agent-unprivileged.html" title="Run Elastic Agent without administrative privileges">Run Elastic Agent without administrative privileges</a>.</p>
</div>
</div>
<p>If you’re prompted with <code class="literal">Elastic Agent will be installed at {installation location} and will run as a service. Do you want to continue?</code> answer <code class="literal">Yes</code>.</p>
<p>If you’re prompted with <code class="literal">Do you want to enroll this Agent into Fleet?</code> answer <code class="literal">no</code>.</p>
</li>
<li class="listitem">
<p>You can run the <code class="literal">status</code> command to confirm that Elastic Agent is running.</p>
<div class="pre_wrapper lang-cmd">
<div class="console_code_copy" title="Copy to clipboard"></div>
<pre class="programlisting prettyprint lang-cmd">elastic-agent status
┌─ fleet
│ └─ status: (STOPPED) Not enrolled into Fleet
└─ elastic-agent
└─ status: (HEALTHY) Running</pre>
</div>
<p>Since you’re running the agent in standalone mode the <code class="literal">Not enrolled into Fleet</code> message is expected.</p>
</li>
<li class="listitem">
Open the <code class="literal">elastic-agent.yml</code> policy file that you saved.
</li>
<li class="listitem">
<p>Near the top of the file, replace:</p>
<div class="pre_wrapper lang-yaml">
<div class="console_code_copy" title="Copy to clipboard"></div>
<pre class="programlisting prettyprint lang-yaml"> username: '${ES_USERNAME}'
password: '${ES_PASSWORD}'</pre>
</div>
<p>with:</p>
<div class="pre_wrapper lang-yaml">
<div class="console_code_copy" title="Copy to clipboard"></div>
<pre class="programlisting prettyprint lang-yaml"> api_key: '<your-api-key>'</pre>
</div>
<p>where <code class="literal">your-api-key</code> is the API key that you generated in <a class="xref" href="example-standalone-monitor-nginx-serverless.html#nginx-guide-create-api-key-serverless" title="Step 3: Create an Elasticsearch API key">Step 3: Create an Elasticsearch API key</a>.</p>
</li>
<li class="listitem">
Find the location of the default <code class="literal">elastic-agent.yml</code> policy file that is included in your Elastic Agent install. Install directories for each platform are described in <a class="xref" href="installation-layout.html" title="Installation layout">Installation layout</a>. In our example Ubuntu image the default policy file can be found in <code class="literal">/etc/elastic-agent/elastic-agent.yml</code>.
</li>
<li class="listitem">
<p>Replace the default policy file with the version that you downloaded and updated. For example:</p>
<div class="pre_wrapper lang-sh">
<div class="console_code_copy" title="Copy to clipboard"></div>
<pre class="programlisting prettyprint lang-sh">cp /home/ubuntu/homedir/downloads/elastic-agent.yml /etc/elastic-agent/elastic-agent.yml</pre>
</div>
<div class="note admon">
<div class="icon"></div>
<div class="admon_content">
<p>You may need to prefix the <code class="literal">cp</code> command with <code class="literal">sudo</code> for the permission required to replace the default file.</p>
</div>
</div>
<p>By default, Elastic Agent monitors the configuration file and reloads the configuration automatically when <code class="literal">elastic-agent.yml</code> is updated.</p>
</li>
<li class="listitem">
<p>Run the <code class="literal">status</code> command again, this time with the <code class="literal">--output yaml</code> option which provides structured and much more detailed output. See the <a class="xref" href="elastic-agent-cmd-options.html#elastic-agent-status-command" title="elastic-agent status"><code class="literal">elastic-agent status</code></a> command documentation for more details.</p>
<div class="pre_wrapper lang-shell">
<div class="console_code_copy" title="Copy to clipboard"></div>
<pre class="programlisting prettyprint lang-shell">elastic-agent status --output yaml</pre>
</div>
<p>The results show you the agent status together with details about the running components, which correspond to the inputs and outputs defined for the integrations that have been added to the Elastic Agent policy, in this case the System and Nginx Integrations.</p>
</li>
<li class="listitem">
<p>At the top of the command output, the <code class="literal">info</code> section contains details about the agent instance. Make a note of the agent ID. In this example the ID is <code class="literal">4779b439-1130-4841-a878-e3d7d1a457d0</code>. You’ll use that ID in the next section.</p>
<div class="pre_wrapper lang-yaml">
<div class="console_code_copy" title="Copy to clipboard"></div>
<pre class="programlisting prettyprint lang-yaml">elastic-agent status --output yaml
info:
id: 4779b439-1130-4841-a878-e3d7d1a457d0
version: 8.9.1
commit: 5640f50143410fe33b292c9f8b584117c7c8f188
build_time: 2023-08-10 17:04:04 +0000 UTC
snapshot: false
state: 2
message: Running</pre>
</div>
</li>
</ol>
</div>
<div class="position-relative"><h5><a id="nginx-guide-confirm-agent-data-serverless"></a>Step 7: Confirm that your Elastic Agent data is flowing</h5><a class="edit_me" rel="nofollow" title="Edit this page on GitHub" href="https://github.com/elastic/ingest-docs/edit/8.18/docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-serverless.asciidoc">edit</a></div>
<p>Now that Elastic Agent is running, it’s time to confirm that the agent data is flowing into Elasticsearch.</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
<p>Check that Elastic Agent logs are flowing.</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
Open the Kibana menu and go to <span class="strong strong"><strong>Observability → Discover</strong></span>.
</li>
<li class="listitem">
<p>In the KQL query bar, enter the query <code class="literal">agent.id : "{agent-id}"</code> where <code class="literal">{agent-id}</code> is the ID you retrieved from the <code class="literal">elastic-agent status --output yaml</code> command. For example: <code class="literal">agent.id : "4779b439-1130-4841-a878-e3d7d1a457d0"</code>.</p>
<p>If Elastic Agent has connected successfully with your Elastic Cloud deployment, the agent logs should be flowing into Elasticsearch and visible in Kibana Discover.</p>
<div class="imageblock">
<div class="content">
<img src="images/guide-agent-logs-flowing.png" alt="Kibana Discover shows agent logs are flowing into Elasticsearch.">
</div>
</div>
</li>
</ol>
</div>
</li>
<li class="listitem">
<p>Check that Elastic Agent metrics are flowing.</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
Open the Kibana menu and go to <span class="strong strong"><strong>Observability → Dashboards</strong></span>.
</li>
<li class="listitem">
<p>In the search field, search for <code class="literal">Elastic Agent</code> and select <code class="literal">[Elastic Agent] Agent metrics</code> in the results.</p>
<p>like the agent logs, the agent metrics should be flowing into Elasticsearch and visible in Kibana Dashboard. You can view metrics on CPU usage, memory usage, open handles, events rate, and more.</p>
<div class="imageblock">
<div class="content">
<img src="images/guide-agent-metrics-flowing.png" alt="Kibana Dashboard shows agent metrics are flowing into Elasticsearch.">
</div>
</div>
</li>
</ol>
</div>
</li>
</ol>
</div>
<div class="position-relative"><h5><a id="nginx-guide-view-system-data-serverless"></a>Step 8: View your system data</h5><a class="edit_me" rel="nofollow" title="Edit this page on GitHub" href="https://github.com/elastic/ingest-docs/edit/8.18/docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-serverless.asciidoc">edit</a></div>
<p>In the step to <a class="xref" href="example-standalone-monitor-nginx-serverless.html#nginx-guide-create-policy-serverless" title="Step 4: Create an Elastic Agent policy">create an Elastic Agent policy</a> you chose to collect system logs and metrics, so you can access those now.</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
<p>View your system logs.</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
Open the Kibana menu and go to <span class="strong strong"><strong>Project settings → Integrations → Installed integrations</strong></span>.
</li>
<li class="listitem">
Select the <span class="strong strong"><strong>System</strong></span> card and open the <span class="strong strong"><strong>Assets</strong></span> tab. This is a quick way to access all of the dashboards, saved searches, and visualizations that come with each integration.
</li>
<li class="listitem">
Select <code class="literal">[Logs System] Syslog dashboard</code>.
</li>
<li class="listitem">
Select the calandar icon and change the time setting to <code class="literal">Today</code>. The Kibana Dashboard shows visualizations of Syslog events, hostnames and processes, and more.
</li>
</ol>
</div>
</li>
<li class="listitem">
<p>View your system metrics.</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
Return to <span class="strong strong"><strong>Project settings → Integrations → Installed integrations</strong></span>.
</li>
<li class="listitem">
Select the <span class="strong strong"><strong>System</strong></span> card and open the <span class="strong strong"><strong>Assets</strong></span> tab.
</li>
<li class="listitem">
This time, select <code class="literal">[Metrics System] Host overview</code>.
</li>
<li class="listitem">
<p>Select the calandar icon and change the time setting to <code class="literal">Today</code>. The Kibana Dashboard shows visualizations of host metrics including CPU usage, memory usage, running processes, and others.</p>
<div class="imageblock">
<div class="content">
<img src="images/guide-system-metrics-dashboard.png" alt="The System metrics host overview showing CPU usage, memory usage, and other visualizations">
</div>
</div>
</li>
</ol>
</div>
</li>
</ol>
</div>
<div class="position-relative"><h5><a id="nginx-guide-view-nginx-data-serverless"></a>Step 9: View your nginx logging data</h5><a class="edit_me" rel="nofollow" title="Edit this page on GitHub" href="https://github.com/elastic/ingest-docs/edit/8.18/docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-serverless.asciidoc">edit</a></div>
<p>Now let’s view your nginx logging data.</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
Open the Kibana menu and go to <span class="strong strong"><strong>Project settings → Integrations → Installed integrations</strong></span>.
</li>
<li class="listitem">
Select the <span class="strong strong"><strong>Nginx</strong></span> card and open the <span class="strong strong"><strong>Assets</strong></span> tab.
</li>
<li class="listitem">
Select <code class="literal">[Logs Nginx] Overview</code>. The Kibana Dashboard opens with geographical log details, response codes and errors over time, top pages, and more.
</li>
<li class="listitem">
<p>Refresh your nginx web page several times to update the logging data. You can also try accessing the nginx page from different web browsers. After a minute or so, the <code class="literal">Browsers breakdown</code> visualization shows the respective volume of requests from the different browser types.</p>
<div class="imageblock">
<div class="content">
<img src="images/guide-nginx-browser-breakdown.png" alt="Kibana Dashboard shows agent metrics are flowing into Elasticsearch.">
</div>
</div>
</li>
</ol>
</div>
<p>Congratulations! You have successfully set up monitoring for nginx using standalone Elastic Agent and an Elastic Cloud Serverless project.</p>
<div class="position-relative"><h5><a id="_whats_next"></a>What’s next?</h5><a class="edit_me" rel="nofollow" title="Edit this page on GitHub" href="https://github.com/elastic/ingest-docs/edit/8.18/docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-serverless.asciidoc">edit</a></div>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
Learn more about <a class="xref" href="fleet-overview.html" title="Fleet and Elastic Agent overview">Fleet and Elastic Agent</a>.
</li>
<li class="listitem">
Learn more about <a href="https://docs.elastic.co/en/integrations" class="ulink" target="_top">Integrations</a>.
</li>
</ul>
</div>
</div>
</div>
</div><div class="navfooter">
<span class="prev">
<a href="grant-access-to-elasticsearch.html">« Grant standalone Elastic Agents access to Elasticsearch</a>
</span>
<span class="next">
<a href="example-standalone-monitor-nginx.html">Example: Use standalone Elastic Agent with Elasticsearch Service to monitor nginx »</a>
</span>
</div>
<!-- end body -->
</div>
<div class="col-12 order-3 col-lg-2 order-lg-3 h-almost-full-lg sticky-top-lg" id="right_col">
<div id="sticky_content">
<!-- The OTP is appended here -->
<div class="row">
<div class="col-0 col-md-4 col-lg-0" id="bottom_left_col"></div>
<div class="col-12 col-md-8 col-lg-12">
<div id="rtpcontainer">
<div class="mktg-promo" id="most-popular">
<p class="aside-heading">Most Popular</p>
<div class="pb-2">
<p class="media-type">Video</p>
<a href="https://www.elastic.co/webinars/getting-started-elasticsearch?page=docs&placement=top-video">
<p class="mb-0">Get Started with Elasticsearch</p>
</a>
</div>
<div class="pb-2">
<p class="media-type">Video</p>
<a href="https://www.elastic.co/webinars/getting-started-kibana?page=docs&placement=top-video">
<p class="mb-0">Intro to Kibana</p>
</a>
</div>
<div class="pb-2">
<p class="media-type">Video</p>
<a href="https://www.elastic.co/webinars/introduction-elk-stack?page=docs&placement=top-video">
<p class="mb-0">ELK for Logs & Metrics</p>
</a>
</div>
</div>
</div>
<!-- Feedback widget -->
<div id="feedbackWidgetContainer"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<div id='elastic-footer'></div>
<script src='https://www.elastic.co/elastic-footer.js'></script>
<!-- Footer Section end-->
</section>
</div>
<!-- Feedback modal -->
<div id="feedbackModalContainer"></div>
<script src="/guide/static/jquery.js"></script>
<script type="text/javascript" src="/guide/static/docs-v1.js"></script>
<script type="text/javascript">
window.initial_state = {}</script>
</body>
</html>