Skip to content

Commit 5274dd2

Browse files
committed
chore(gen): tutorial content review
1 parent 059fc0f commit 5274dd2

File tree

15 files changed

+446
-718
lines changed

15 files changed

+446
-718
lines changed

tutorials/collecting-visualizing-logs-elastic-stack/index.mdx

Lines changed: 122 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ categories:
1111
- instances
1212
- elastic-metal
1313
dates:
14-
validation: 2024-08-27
14+
validation: 2025-03-06
1515
posted: 2015-06-10
1616
---
1717

18-
The Elastic Stack, formerly known as the ELK Stack, is a powerful suite of open-source tools designed for real-time data search, analysis, and visualization. It offers comprehensive capabilities for collecting, processing, and visualizing large volumes of data.
19-
Its components are:
18+
The Elastic Stack, formerly known as the ELK Stack, is a powerful suite of open-source tools designed for real-time data search, analysis, and visualization. It offers comprehensive capabilities for collecting, processing, and visualizing large volumes of data. Its components are:
2019

21-
- **[Elasticsearch](https://www.elastic.co/elasticsearch)** A distributed, RESTful search and analytics engine based on the Lucene library.
22-
- **[Logstash](https://www.elastic.co/logstash)** A flexible data collection, processing, and enrichment pipeline.
23-
- **[Kibana](https://www.elastic.co/kibana)** A visualization and exploration tool for analyzing and visualizing data stored in Elasticsearch.
24-
- **[Beats](https://www.elastic.co/beats/)** Lightweight data shippers for ingesting data into Elasticsearch or Logstash.
20+
- **[Elasticsearch](https://www.elastic.co/elasticsearch)**: A distributed, RESTful search and analytics engine based on the Lucene library.
21+
- **[Logstash](https://www.elastic.co/logstash)**: A flexible data collection, processing, and enrichment pipeline.
22+
- **[Kibana](https://www.elastic.co/kibana)**: A visualization and exploration tool for analyzing and visualizing data stored in Elasticsearch.
23+
- **[Beats](https://www.elastic.co/beats/)**: Lightweight data shippers for ingesting data into Elasticsearch or Logstash.
2524

2625
<Macro id="requirements" />
2726

@@ -30,38 +29,66 @@ Its components are:
3029
- An [SSH key](/organizations-and-projects/how-to/create-ssh-key/)
3130
- An [Instance](/instances/how-to/create-an-instance/) or an [Elastic Metal server](/elastic-metal/how-to/create-server/) with at least 4 GB of RAM
3231

33-
### Install Elasticsearch
32+
## Install Elasticsearch
3433

3534
1. Download and install the Elasticsearch signing key:
3635
```bash
3736
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | gpg --dearmor -o /usr/share/keyrings/elasticsearch-archive-keyring.gpg
3837
```
39-
2. Add the Elasticsearch repository.
38+
39+
2. Add the Elasticsearch repository:
4040
```bash
4141
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-archive-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | tee /etc/apt/sources.list.d/elastic-8.x.list
4242
```
43-
3. Update the `apt` package repositories.
43+
44+
3. Update the `apt` package repositories:
4445
```bash
4546
apt update
4647
```
47-
4. Install Elasticsearch using `apt`.
48+
49+
4. Install Elasticsearch:
4850
```bash
4951
apt install elasticsearch
5052
```
51-
5. Start and enable the Elasticsearch service.
53+
54+
5. Start and enable the Elasticsearch service:
5255
```bash
5356
systemctl start elasticsearch
5457
systemctl enable elasticsearch
5558
```
5659

60+
6. Configure Elasticsearch for production:
61+
Modify the `elasticsearch.yml` file to optimize Elasticsearch for production use:
62+
```bash
63+
nano /etc/elasticsearch/elasticsearch.yml
64+
```
65+
66+
Add the following:
67+
```yaml
68+
cluster.name: "my-cluster"
69+
node.name: "node-1"
70+
network.host: 0.0.0.0
71+
xpack.security.enabled: true
72+
xpack.security.transport.ssl.enabled: true
73+
xpack.security.http.ssl.enabled: true
74+
xpack.security.http.ssl.keystore.path: /etc/elasticsearch/certs/keystore.p12
75+
xpack.security.http.ssl.truststore.path: /etc/elasticsearch/certs/truststore.p12
76+
```
77+
78+
<Message type="note">
79+
Make sure you have SSL certificates set up for secure communication.
80+
</Message>
81+
82+
5783
## Install and configure Logstash
5884
59-
1. Using the same repository added for Elasticsearch, you can simply install Logstash:
85+
1. Install Logstash using the same repository added for Elasticsearch:
6086
```bash
6187
apt install logstash
6288
```
6389

64-
2. Once installed, you can create and modify configuration files for Logstash to set up your data pipelines. These are typically found in `/etc/logstash/conf.d/`.
90+
2. Create and modify configuration files for Logstash:
91+
The configuration files for Logstash are typically located in `/etc/logstash/conf.d/`. You can create pipelines to manage your data processing.
6592

6693
3. Start and enable the Logstash service:
6794
```bash
@@ -71,7 +98,7 @@ Its components are:
7198

7299
## Install and configure Kibana
73100

74-
1. Install Kibana using the repository:
101+
1. Install Kibana:
75102
```bash
76103
apt install kibana
77104
```
@@ -82,25 +109,96 @@ Its components are:
82109
systemctl enable kibana
83110
```
84111

85-
3. By default, Kibana is accessible on `http://localhost:5601`. If you need to access it from a remote machine, edit the Kibana configuration file `/etc/kibana/kibana.yml` and set the server host:
112+
3. Configure Kibana for remote access:
113+
By default, Kibana is accessible on `http://localhost:5601`. To make Kibana accessible remotely, edit the Kibana configuration file:
114+
```bash
115+
nano /etc/kibana/kibana.yml
86116
```
117+
118+
Change the server host to:
119+
```yaml
87120
server.host: "0.0.0.0"
88121
```
89122
90-
## Secure the Elastic stack
123+
4. Secure Kibana:
124+
Ensure Kibana uses SSL to encrypt communications by adding SSL certificates in the `kibana.yml` file:
125+
```yaml
126+
server.ssl.enabled: true
127+
server.ssl.certificate: /etc/kibana/certs/kibana.crt
128+
server.ssl.key: /etc/kibana/certs/kibana.key
129+
elasticsearch.ssl.certificate: /etc/kibana/certs/kibana.crt
130+
elasticsearch.ssl.key: /etc/kibana/certs/kibana.key
131+
```
132+
133+
## Install and configure Filebeat
134+
135+
1. Install Filebeat:
136+
```bash
137+
apt install filebeat
138+
```
91139

92-
It is important to secure your ELK Stack, especially if it is exposed to the public internet. You can complete your setup using the following additional resources:
140+
2. Configure Filebeat to ship logs to Elasticsearch:
141+
Edit the Filebeat configuration file to point to your Elasticsearch instance:
142+
```bash
143+
nano /etc/filebeat/filebeat.yml
144+
```
145+
146+
Set the output to Elasticsearch:
147+
```yaml
148+
output.elasticsearch:
149+
hosts: ["http://localhost:9200"]
150+
```
151+
152+
Alternatively, configure Filebeat to send logs to Logstash:
153+
```yaml
154+
output.logstash:
155+
hosts: ["localhost:5044"]
156+
```
157+
158+
3. Start and enable the Filebeat service:
159+
```bash
160+
systemctl enable filebeat
161+
systemctl start filebeat
162+
```
163+
164+
## Secure the Elastic Stack
165+
166+
Securing your Elastic Stack is essential, especially if exposed to the internet. Following are some recommendations:
167+
168+
- Enable built-in security features (as shown above in Elasticsearch and Kibana setup).
169+
170+
- Use a firewall:
171+
You can use `ufw` or `iptables` to restrict access to only the necessary IPs:
172+
```bash
173+
ufw allow from <your_ip> to any port 9200
174+
ufw allow from <your_ip> to any port 5601
175+
```
176+
177+
- Set up an HTTPS reverse proxy:
178+
You can secure Kibana by setting up an HTTPS reverse proxy with Nginx:
179+
[Set up an HTTPS reverse proxy with Nginx](https://www.scaleway.com/docs/tutorials/nginx-reverse-proxy/).
180+
181+
- Set up TLS/SSL for Elasticsearch and Kibana: Ensure communications are encrypted between components using SSL/TLS as shown above.
93182

94-
- [Use a firewal](/tutorials/installation-uncomplicated-firewall/) like `ufw` or `iptables` to restrict access to your Instance.
95-
- [Secure Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-minimal-setup.html) using its built-in security features or with plugins.
96-
- Consider setting up an [HTTPS reverse proxy](/tutorials/nginx-reverse-proxy/) using a third-party web server like Nginx or Apache to access Kibana securely.
97183

98184
## Test the installation
99185

100-
Make sure everything is working:
186+
After completing the setup, you can verify if everything is working:
187+
188+
- Elasticsearch:
189+
Run the following command to check Elasticsearch health:
190+
```bash
191+
curl -X GET "localhost:9200/_cluster/health?pretty"
192+
```
193+
194+
- Kibana:
195+
Navigate to `http://your_server_ip:5601` in your web browser.
101196

102-
- Elasticsearch Run the following command to test your Elasticsearch installation: `curl -X GET "localhost:9200/"`
103-
- Kibana: Navigate to `http://your_server_ip:5601` in your web browser.
197+
- Filebeat:
198+
Ensure logs are being shipped by checking the status:
199+
```bash
200+
curl -X GET "localhost:5601/api/status"
201+
```
104202

105203
Now, you should have a basic Elastic stack up and running! Adjust configurations as needed for your specific use case and further secure and optimize your setup for production use.
106204
Refer to the [official Elastic documentation](https://www.elastic.co/guide/index.html) for the most accurate and up-to-date instructions and advanced configuration information.

0 commit comments

Comments
 (0)