Elastic Stack 7 : Install Filebeat2021/06/22 |
Install Filebeat that easily ships log file data to Elasticsearch or Logstash.
|
|
[1] | Install Filebeat. Configure Elasticsearch repository before it. |
[root@dlp ~]# dnf -y install filebeat
|
[2] | Configure basic settings and start Filebeat. |
[root@dlp ~]#
vi /etc/filebeat/filebeat.yml # line 21 : set items to collect data # if collect logs, turn to [enabled: true] # by default, /var/log/*.log files are shipped
- type: log
# Change to true to enable this prospector configuration.
enabled: true
# Paths that should be crawled and fetched. Glob based paths.
paths:
- /var/log/*.log
#- c:\programdata\elasticsearch\logs\*
# Exclude lines. A list of regular expressions to match. It drops the lines that are
# matching any regular expression from the list.
#exclude_lines: ['^DBG']
# Include lines. A list of regular expressions to match. It exports the lines that are
# matching any regular expression from the list.
#include_lines: ['^ERR', '^WARN']
# Exclude files. A list of regular expressions to match. Filebeat drops the files that
# are matching any regular expression from the list. By default, no files are dropped.
#exclude_files: ['.gz$']
.....
.....
# line 151 : if use Kibana, uncomment and specify output host # if SSL is enabled on Kibana, hostname should be the same with the hostname in certs
setup.kibana:
.....
host: "https://dlp.srv.world:5601"
# line 178 : specify output host # the default is localhost's Elasticsearch # if output to Logstash, comment out Elasticsearch and uncomment logstash lines output.elasticsearch: # Array of hosts to connect to.l hosts: ["localhost:9200"] ..... ..... #output.logstash: # The Logstash hosts #hosts: ["localhost:5044"]
[root@dlp ~]#
vi /etc/filebeat/filebeat.reference.yml # line 15 : set items to collect data - module: system # Syslog syslog: enabled: true ..... ..... # Authorization logs auth: enabled: true # line 4281 : if use Kibana, uncomment and specify output host # if SSL is enabled on Kibana, uncomment ssl related lines # if your certs is self-siged one, ssl.verification_mode should be [none] setup.kibana: # Kibana Host # Scheme and port can be left out and will be set to the default (http and 5601) # In case you specify and additional path, the scheme is required: http://localhost:5601/path # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601 host: "dlp.srv.world:5601" # Optional protocol and basic auth credentials. protocol: "https" #username: "elastic" #password: "changeme" # Optional HTTP Path #path: "" # Use SSL settings for HTTPS. Default is true. ssl.enabled: true ..... ..... # after very careful consideration. It is primarily intended as a temporary # diagnostic mechanism when attempting to resolve TLS errors; its use in # production environments is strongly discouraged. # The default value is full. ssl.verification_mode: none[root@dlp ~]# systemctl enable --now filebeat
|
[3] | Verify status the data has been collected normally. |
# index list [root@dlp ~]# curl localhost:9200/_cat/indices?v health status index uuid pri rep docs.count docs.deleted store.size pri.store.size green open .kibana_7.13.2_001 zA_r0rrjT7OMUMVSGmRVfg 1 0 2507 158 2.9mb 2.9mb green open .apm-custom-link d1-9Pkn-RXOu_qhMOanvVA 1 0 0 0 208b 208b green open .kibana-event-log-7.13.2-000001 Y-rCmM6yTBKa9W5H1LeJ1g 1 0 1 0 5.6kb 5.6kb yellow open filebeat-7.13.2-2021.06.22-000001 c18zEwqAQVeNecW7d6EAQg 1 1 11685 0 1.8mb 1.8mb green open .apm-agent-configuration y3hQme2SQpGMtb64NLsNdA 1 0 0 0 208b 208b green open .async-search WRLoMwCITRKD3C_BrFJ9bw 1 0 45 7 71.5kb 71.5kb green open .kibana_task_manager_7.13.2_001 x6V232xKQLinqRedJRAbgw 1 0 10 3730 519.6kb 519.6kb yellow open packetbeat-7.13.2-2021.06.22-000001 nYN59YPRQwGmDrMRXijZxA 1 1 12947 0 4mb 4mb yellow open test_index Vh0HutpLRciaMWX3pFo7Zg 1 1 1 0 5.5kb 5.5kb yellow open sshd_fail-2021.06 HiOI2ac-RzK2BiwQ_gb-VQ 1 1 28 0 54.4kb 54.4kb yellow open metricbeat-7.13.2-2021.06.22-000001 aVbbCHScQBujmT8JMRdRBw 1 1 12040 0 7.4mb 7.4mb # document list on the index [root@dlp ~]# curl localhost:9200/filebeat-7.13.2-2021.06.22-000001/_search?pretty { "took" : 5, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 10000, "relation" : "gte" }, "max_score" : 1.0, "hits" : [ { "_index" : "filebeat-7.13.2-2021.06.22-000001", "_type" : "_doc", "_id" : "o6EKMnoB8xzJeutJY9g5", "_score" : 1.0, "_source" : { "@timestamp" : "2021-06-22T04:46:13.483Z", "ecs" : { "version" : "1.8.0" }, "host" : { "id" : "54f4bd7df8464337a3009215fdef55fb", "containerized" : false, "ip" : [ "10.0.0.30", "fe80::e38e:e34:9b82:29a2" ], ..... ..... |
[4] | If Kibana is running, it's possible to import data to sample Dashboards. |
[root@dlp ~]# filebeat setup --dashboards Loading dashboards (Kibana must be running and reachable) Loaded dashboards |
Sponsored Link |