Elasticsearch is the distributed search and analytics engine at the heart of the Elastic Stack. The ElastiFlow Unified Flow Collector can be configured to store the collected, processed and enriched records in Elasticsearch. Kibana enables you to interactively explore, visualize, and share insights into your data and manage and monitor the stack. Elasticsearch is where the indexing, search, and analysis happens.
This document describes in detail the installation of the ElastiFlow Unified Flow Collector and the Elastic Stack (Elasticsearch and Kibana) on a single server running CentOS 7. These steps should work similarly for other RedHat-based Linux distributions.
Elasticsearch can be deployed as a single-mode server or multi-node cluster. The latter provides for horizontal scaling to handle very high ingest rates and longer retention periods. For more information on properly sizing an Elasticsearch cluster, see Sizing.
:::info The hostname and IP address above are for examples only. You MUST replace these values with those of your own server when executing any commands or editing any files. :::
Elasticsearch uses a mmapfs
directory by default to store its indices. The Linux default limits on mmaps is usually too low, which can result in out-of-memory exceptions. This limit should be raised to 262144
.
Run the following command to add the file /etc/sysctl.d/70-elasticsearch.conf
with the attribute vm.max_map_count=262144
:
The default Linux network parameters are not optimal for high throughput applications, in particular a high volume of ingress UDP packets. This can result in dropped packets and lost data. Linux network performance for ElastiFlow can optimized by changing the parameters below.
Run the following command to add the file /etc/sysctl.d/60-net.conf
with the recommended changes.
For changes to the above parameters to take effect the system can be restarted. Alternatively the following commands can be run to apply the changes without a reboot:
The easiest way to get started is to disable the Linux firewall. Alternatively the firewall can be configured to allow access to any required ports. Details of configuring the Linux firewall are beyond the scope of this document. However if enabled, you will need to allow access to the following ports:
Run the following commands to install required packages.
Download and install the public signing key.
Add the Elastic repository definition to /etc/yum.repos.d/elasticsearch.repo
by running the following command.
yum
Run the following commands to install the Elasticsearch package.
If a JVM is started with unequal initial and max heap sizes, it may pause as the JVM heap is resized during system usage. For this reason it’s best to start the JVM with the initial and maximum heap sizes set to equal values.
Add the file heap.options
to /etc/elasticsearch/jvm.options.d
and set -Xms
and -Xmx
to about one third of the system memory, but do not exceed 31g
. For this example we will use 12GB of the available 32GB of memory for JVM heap.
Increased system limits should be specified in a systemd
attributes file for the elasticsearch
service.
It is first necessary to generate a certificate authority (CA) by running the following command.
When you see Please enter the desired output file [elastic-stack-ca.zip]:
press enter
to accept the default.
The resulting file will be placed in /usr/share/elasticsearch
. To unzip and move the CA key and cert to /etc/elasticsearch/certs
run the following commands.
To generate certificates for the Elasticsearch node, create a file named /usr/share/elasticsearch/instances.yml
similar to the following. Replace the values with those appropriate for your environment.
For example, in the system used for this guide, the name of the server is myhost
, the IP address is 192.168.56.101
and there is no name configured in DNS. The instance would contain:
Use elasticsearch-certutil
to generate the certificates and keys from the CA and instances file.
The resulting file will be placed in /usr/share/elasticsearch
. To unzip and move the node keys and certs to /etc/elasticsearch/certs
run the following commands.
Edit the Elasticsearch configuration file, /etc/elasticsearch/elasticsearch.yml
, replacing the contents of the file with the following configuration. Edit as necessary for your environment.
:::note If you want Elasticsearch data to be stored on a different mount point, you must first create the directory and assign permissions to the elasticsearch
. For example, to store data on /mnt/data0
, run sudo mkdir /mnt/data0/elasticsearch && sudo chown -R elasticsearch:elasticsearch /mnt/data0/elasticsearch
. The edit the path.data
option in elasticsearch.yml
specifying this path. :::
Execute the following commands to start Elasticsearch and enable it run automatically when the server boots:
Confirm Elasticsearch started successfully by executing:
Execute the following command for to setup passwords for the various built-in accounts:
The following will be displayed:
Answer y
, then enter and confirm passwords for the built-in Elasticsearch accounts.
Ensure that the Elasticsearch REST API is available by running the following:
The output should be similar to the following:
yum
Run the following commands to install the Kibana package.
Kibana will also require access to the CA, certificates and keys. To use the same files that were created for Elasticsearch, copy them from /etc/elasticsearch
to /etc/kibana
.
Edit the Kibana configuration file /etc/kibana/kibana.yml
, replacing the contents of the file with the following configuration. Edit as necessary for your environment (especially elasticsearch.password
).
Execute the following commands:
Confirm Kibana started successfully by executing:
You should now be able to access Kibana at https://IP_OF_KIBANA_HOST:5601
. Since this HTTPS connection is using a self-signed certificate, you may see an error similar to the following.
Chrome:
Firefox:
Safari:
You need to either create an exception in your browser, or import and trust the CA certificate on the system running the browser. This can usually be achieved by downloading the ca.crt
file from the server. Double-clicking it will usually prompt you to import the certificate. On MacOS the certificate should appear as follows in the keychain application after it is configured to be trusted.
You should now be able to connect to Kibana after allowing an exception. To login use the user elastic
and the password you defined earlier for this user.
The ElastiFlow Unified Flow Collector can be installed natively on Ubuntu and Debian Linux. The instructions are available here. In this section we will cover the primary configuration options for the Elasticsearch output.
The Unified Flow Collector options are configured using environment variables. To configure the environment variables, edit the file /etc/systemd/system/flowcoll.service.d/flowcoll.conf
. For details on all of the configuration options, please refer to the Configuration Reference.
:::note After requesting a license it can take up to 30 minutes for the email to arrive. :::
License keys are generated per account. EF_ACCOUNT_ID
must contain the Account ID for the License Key specified in EF_FLOW_LICENSE_KEY
. The number of licensed units will be 1
for a Basic license, and up to 64 for a 30-day Trial. The ElastiFlow EULA must also be accepted to use the software.
The Unified Flow Collector will require access to the CA certificate to verify the Elasticsearch node. Copy the CA certificate from /etc/elasticsearch/certs/ca/ca.crt
to /etc/elastiflow/ca/ca.crt
.
Set EF_OUTPUT_ELASTICSEARCH_ENABLE
to true
to enable the Elasticsearch output.
The Unified Flow Collector outputs data using ElastiFlow's CODEX schema. Optionally you can choose to output data in Elastic Common Schema (ECS). To do so, set EF_OUTPUT_ELASTICSEARCH_ECS_ENABLE
to true
.
@timestamp
There are multiple possible sources to set the value of @timestamp
field, which is the primary timestamp field used by Kibana. They supported options are:
Usually end
would be the best setting. However, in the case of poorly behaving or misconfigured devices, collect
may be the better option. The actual timestamp used may be different than configured depending on the content of the received records. If end
is not available the collector will fall back to export
. If export
is not available the collector will fall back to collect
.
For this small single node install set the number of shards to 1
and replicas to 0
.
:::note The optimum value for these settings will depend on a number of factors. The number of shards should be at least 1 for each Elasticsearch data node in a cluster. Larger nodes (16+ CPU cores) and higher ingest rates can benefit from 2 shards per node. The largest nodes (64 CPU cores, 8 memory channels and multiple SSD drives) can even benefit from 3 or 4 shards per node. In a multi-node cluster 1 or more replicas may be specified for redundancy. :::
Index Lifecycle Management (ILM) can be used to rollover the indices which store the ElastiFlow data, preventing issues that can occur when shards become too large. Enable rollover by setting, EF_OUTPUT_ELASTICSEARCH_INDEX_PERIOD
to rollover
. When enabled the collector will automatically bootstrap the initial index and write alias.
The default Index Lifecycle Management (ILM) lifecycle is elastiflow
. If this lifecycle doesn't exist a basic lifecycle will be added which will remove data after 7 days. This lifecycle can be edited later via Kibana or the Elasticsearch ILM API.
Define the Elasticsearch node to which the collector should connect and the credentials for which the password was defined during the Elasticsearch installation.
Enable TLS and specify the path to the CA certificate.
Execute the following commands:
Confirm the service started successfully by executing:
The collector is now ready to receive flow records from the network infrastructure.
The last step is to import the Kibana saved objects and apply the recommended advanced settings. Follow the instructions in the Kibana section of the documentation for detailed instructions.
Elastic signs all of their packages with the Elasticsearch Signing Key (PGP key D88E42B4
, available from ) with fingerprint: 4609 5ACC 8548 582C 1A26 99A9 D27D 666C D88E 42B4
There are numerous ways to generate certificates that can be used to secure communications using TLS. To simplify the process Elastic provides the elasticsearch-certutil
tool. For more details about this tool, refer to .
Without a license key the ElastiFlow Unified Flow Collector runs with a Community tier license. The Basic tier is also available at no cost and supports additional standard information elements. A license can be . Alternatively , which increases the scalability of the collector and enables all supported vendor and standard information elements.
Hostname
myhost
IP Address
192.168.56.101
CPU Cores
4
Memory
32 GB
Storage
1 TB
OS
CentOS 7
Elasticsearch
7.17.14
Kibana
7.17.14
ES Features
TLS, RBAC
ElastiFlow UFC
6.4.2
Elasticsearch
TCP/9200
Kibana
TCP/5601
Unified Flow Collector
UDP 9995 or other port(s) configured by EF_FLOW_SERVER_UDP_PORT
start
flow.start.timestamp
The flow start time indicated in the flow.
end
flow.end.timestamp
The flow end time (or last reported time).
export
flow.export.timestamp
The time from the flow record header.
collect
flow.collect.timestamp
The time that the collector processed the flow record.