Quick Start: Devices
This chapter will help you get started with devices to ingest data with specific protocols, walking you through common scenarios.
For a general discussion, see our overview chapter.
Configuration Files
The device configuration files reside in the devices
directory under the config
folder, and have a .yml
extension:
├───config
│ ├───devices
│ │ syslog.yml
│ │
│ ├───routes
│ │ default.yml
│ │
│ └───targets
│ console.yml
│ file.yml
Director discovers these files by traversing the subdirectories recursively.
Each device type provides specific options detailed in its respective chapter.
You can organize your device files as you wish, regardless of the above folder tree. This can be done in two ways:
-
Using a standalone file:
- PowerShell
- Bash
C:\Users\<user-name>\Documents\syslog.yml
~: syslog.yml
-
Using a listener-based grouping:
- PowerShell
- Bash
C:\<vm_root>\listeners\syslog.yml
~: <vm_root>/listeners/syslog.yml
Choose the one that best fits your needs.
Basic UDP Setup
1. Create Configuration
Create a text file with a .yml
extension in your preferred location, and then open it with a text editor to enter the following:
- id: 1
name: syslog_udp
type: syslog
properties:
protocol: udp
address: 0.0.0.0
port: 514
This YAML code specifies that your device is a Syslog, and that you will use UDP as your listening protocol on port 514
. You can enter any integer as your id
value.
2. Test Configuration
You can now test this configuration using either Director's cross-platform companion Generator or traditional tools available:
- Windows
- Linux
- macOS
Using Generator
vmetric-generator -mode=syslog -address=127.0.0.1:514 -message="Test Message"
Using Generator
vmetric-generator -mode=syslog -address=127.0.0.1:514 -message="Test Message"
Using System Logger
logger -n 127.0.0.1 -P 514 "Test message"
Using System Logger
logger -n 127.0.0.1 -P 514 "Test message"
Secure TCP Setup
We will now create a secure TLS configuration.
1. Prepare Certificates
First we have to prepare the TLS certificates. This can be done using either Director or OpenSSL.
- Windows
- Linux
- macOS
Using Director
vmetric-director -pfx2pem=./cert-file.pfx # Windows
Using Director
vmetric-director -pfx2pem=./cert-file.pfx
Using OpenSSL
openssl genrsa -out server.key 2048
openssl req -new -x509 -key server.key -out server.crt -days 365
Using Director
vmetric-director -pfx2pem=./cert-file.pfx
Using OpenSSL
openssl genrsa -out server.key 2048
openssl req -new -x509 -key server.key -out server.crt -days 365
This generates the key.pem
and cert.pem
files.
Always use TLS encryption in production environments, especially over untrusted networks. Ensure proper file permissions are set on these files:
- the private key file (
key.pem
) should be readable only by the Director process - the certificate file (
cert.pem
) can be world-readable
2. Place Certificates
Now that we have created these files, we must copy them to our installation root directory:
- Windows
- Linux
- macOS
Copy-Item cert.pem key.pem <vm_root>/
cp cert.pem key.pem <vm_root>/
cp cert.pem key.pem <vm_root>/
3. Create Secure Configuration
We will now prepare a secure configuration by creating another .yml
file named secure_syslog.yml
:
- id: 2
name: syslog_secure
type: syslog
properties:
protocol: tcp
address: 0.0.0.0
port: 6514
tls:
status: true
cert_name: cert.pem
key_name: key.pem
framing: octet
max_connections: 1000
timeout: 300
batch_size: 5000
queue:
interval: 2
Note that we have specified the certificate files we have previously created.
4. Test Configuration
Test the secure connection:
- Windows
- Linux
- macOS
Write-Output "Test secure message" | openssl s_client -connect 127.0.0.1:6514
echo "Test secure message" | openssl s_client -connect 127.0.0.1:6514
echo "Test secure message" | openssl s_client -connect 127.0.0.1:6514
Monitoring
Check Director's logs for success messages on launching and initialization, connection acceptance, and configuration validation.
Worker counts, buffer sizes, and batch settings can be adjusted based on your volumes.
Optimizing
For high-volume environments, add the following to your configuration:
reuse: true
workers: 4
buffer_size: 32768
flush_interval: 5
These parameters will all have an impact on performance.