Not Getting Logs in Elastic Stack

Hi,
i recently install latest version of elastic stack(Elasticsearch, kibana, logstash and filebeat) but iam not getting logs in elastic stack. please any one help me.

curl -X GET "localhost:9200/_cat/indices?v"
output:
yellow open .ds-filebeat-8.2.0-2022.05.16-000001 1pBMuUMCSe-AJhtWpxiGVw 1 1 0 0 225b 225b

sudo filebeat setup
output:
Overwriting ILM policy is disabled. Set setup.ilm.overwrite: true for enabling.

Index setup finished.
Loading dashboards (Kibana must be running and reachable)
Loaded dashboards
Loaded Ingest pipelines

please anyone help this issue

Thanks in Advance

Hello @Rajesh119

in filebeat.yml file add this line setup.ilm.overwrite: true
Ensure Kibana and Elasticsearch is running then execute the filebeat setup command.

Keep Posted!!! Thanks!!!

For More information. Please refer

Thank you @sudhagar_ramesh

in filebeat.yml file whare can i add this(like under logstash.outputs:) setup.ilm.overwrite: true

And i used below command to know the setup

filebeat setup
output:
Exiting: Index management requested but the Elasticsearch output is not configured/enabled

Please help me i stucked from last few days

Thanks in advance

@Rajesh119 try adding under General

Keep Posted!!! Thanks!!!

@sudhagar_ramesh i added under general like below

And restrted filebeat Afeter using command > sudo filebeat setup
output:
Index setup finished.
Loading dashboards (Kibana must be running and reachable)
Loaded dashboards
Loaded Ingest pipelines

!!!Thank you!!!

@sudhagar_ramesh i didn't get logs in elk

@sudhagar_ramesh This is my filebeat.yml setup

###################### Filebeat Configuration Example #########################

# This file is an example configuration file highlighting only the most common
# options. The filebeat.reference.yml file from the same directory contains all the
# supported options with more comments. You can use it as a reference.
#
# You can find the full configuration reference here:
# https://www.elastic.co/guide/en/beats/filebeat/index.html

# For more available modules and options, please see the filebeat.reference.yml sample
# configuration file.

# ============================== Filebeat inputs ===============================

filebeat.inputs:

# Each - is an input. Most options can be set at the input level, so
# you can use different inputs for various configurations.
# Below are the input specific configurations.

# filestream is an input for collecting log messages from files.
- type: log

  # Unique ID among all inputs, an ID is required.
  #id: my-filestream-id

  # Change to true to enable this input 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.
  #prospector.scanner.exclude_files: ['.gz$']

  # Optional additional fields. These fields can be freely picked
  # to add additional information to the crawled log files for filtering
  #fields:
  #  level: debug
  #  review: 1

# ============================== Filebeat modules ==============================

filebeat.config.modules:
  # Glob pattern for configuration loading
  path: ${path.config}/modules.d/*.yml

  # Set to true to enable config reloading
  reload.enabled: false

  # Period on which files under path should be checked for changes
  #reload.period: 10s

# ======================= Elasticsearch template setting =======================

setup.template.settings:
  index.number_of_shards: 1
  #index.codec: best_compression
  #_source.enabled: false


# ================================== General ===================================

# The name of the shipper that publishes the network data. It can be used to group
# all the transactions sent by a single shipper in the web interface.
#name:

# The tags of the shipper are included in their own field with each
# transaction published.
#tags: ["service-X", "web-tier"]

setup.ilm.overwrite: true
# Optional fields that you can specify to add additional information to the
# output.
#fields:
#  env: staging

# ================================= Dashboards =================================
# These settings control loading the sample dashboards to the Kibana index. Loading
# the dashboards is disabled by default and can be enabled either by setting the
# options here or by using the `setup` command.
#setup.dashboards.enabled: false

# The URL from where to download the dashboards archive. By default this URL
# has a value which is computed based on the Beat name and version. For released
# versions, this URL points to the dashboard archive on the artifacts.elastic.co
# website.
#setup.dashboards.url:

# =================================== Kibana ===================================

# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
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: "localhost:5601"

  # Kibana Space ID
  # ID of the Kibana Space into which the dashboards should be loaded. By default,
  # the Default Space will be used.
  #space.id:

# =============================== Elastic Cloud ================================

# These settings simplify using Filebeat with the Elastic Cloud (https://cloud.elastic.co/).

# The cloud.id setting overwrites the `output.elasticsearch.hosts` and
# `setup.kibana.host` options.
# You can find the `cloud.id` in the Elastic Cloud web UI.
#cloud.id:

# The cloud.auth setting overwrites the `output.elasticsearch.username` and
# `output.elasticsearch.password` settings. The format is `<user>:<pass>`.
#cloud.auth:

# ================================== Outputs ===================================

# Configure what output to use when sending the data collected by the beat.

# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["localhost:9200"]
  ssl:
    enabled: true
  #setup.ilm.enabled: true
  # Protocol - either `http` (default) or `https`.
  #protocol: "https"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  #username: "elastic"
  #password: "changeme"
    #index: "filebeat"
    #logging.level: debug
    #logging.selectors: ["publish"]
# ------------------------------ Logstash Output -------------------------------
#output.logstash:
  # The Logstash hosts
  #hosts: ["localhost:5044"]
    #loadbalance: true
    #ssl.enabled: true
  # Optional SSL. By default is off.
  # List of root certificates for HTTPS server verifications
  #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]

  # Certificate for SSL client authentication
  #ssl.certificate: "/etc/pki/client/cert.pem"

  # Client Certificate Key
  #ssl.key: "/etc/pki/client/cert.key"

# ================================= Processors =================================
processors:
  - add_host_metadata:
      when.not.contains.tags: forwarded
  - add_cloud_metadata: ~
  - add_docker_metadata: ~
  - add_kubernetes_metadata: ~

# ================================== Logging ===================================

# Sets log level. The default log level is info.
# Available log levels are: error, warning, info, debug
#logging.level: debug

# At debug level, you can selectively enable logging only for some components.
# To enable all selectors use ["*"]. Examples of other selectors are "beat",
# "publisher", "service".
#logging.selectors: ["*"]

# ============================= X-Pack Monitoring ==============================
# Filebeat can export internal metrics to a central Elasticsearch monitoring
# cluster.  This requires xpack monitoring to be enabled in Elasticsearch.  The
# reporting is disabled by default.

# Set to true to enable the monitoring reporter.
#monitoring.enabled: false

# Sets the UUID of the Elasticsearch cluster under which monitoring data for this
# Filebeat instance will appear in the Stack Monitoring UI. If output.elasticsearch
# is enabled, the UUID is derived from the Elasticsearch cluster referenced by output.elasticsearch.
#monitoring.cluster_uuid:

# Uncomment to send the metrics to Elasticsearch. Most settings from the
# Elasticsearch output are accepted here as well.
# Note that the settings should point to your Elasticsearch *monitoring* cluster.
# Any setting that is not set is automatically inherited from the Elasticsearch
# output configuration, so if you have the Elasticsearch output configured such
# that it is pointing to your Elasticsearch monitoring cluster, you can simply
# uncomment the following line.
#monitoring.elasticsearch:

# ============================== Instrumentation ===============================

# Instrumentation support for the filebeat.
#instrumentation:
    # Set to true to enable instrumentation of filebeat.
    #enabled: false

    # Environment in which filebeat is running on (eg: staging, production, etc.)
    #environment: ""

    # APM Server hosts to report instrumentation results to.
    #hosts:
    #  - http://localhost:8200

    # API Key for the APM Server(s).
    # If api_key is set then secret_token will be ignored.
    #api_key:

    # Secret token for the APM Server(s).
    #secret_token:


# ================================= Migration ==================================

# This allows to enable 6.7 migration aliases
#migration.6_to_7.enabled: true

Please Give me a solution for the above problem in detail, so that it will help me.

Thank you in advance

Hello @Rajesh119

Are you are accessing Elasticsearch cluster with authentication then please mention its credentials here.

example:

output.elasticsearch:
  hosts: ["https://myEShost:9200"]
  username: "<elastic-cluster-username>"
  password: "<elastic-cluster-pwd>" 

Keep Posted !!! Thanks !!!

@sudhagar_ramesh i don't have any credentials

Thanks&Regards

Ensure that there files present in the path that has been mentioned in filebeat.yml configuration

/var/log/*.log

Run setup command once the above configuration verified

output.elasticsearch:
  hosts: ["https://myEShost:9200"]
  username: "<elastic-cluster-username>"
  password: "<elastic-cluster-pwd>" 
  index: "<your-index-name>"

yes i have a log files in this location

/var/log/*.log

After i run command

sudo filebeat setup

Output:
Index setup finished.
Loading dashboards (Kibana must be running and reachable)
Loaded dashboards
Loaded Ingest pipelines

could you please execute and share the output

sudo filebeat setup -e

This is the output for below command:

sudo filebeat setup -e

{"log.level":"info","@timestamp":"2022-05-18T10:53:55.002Z","log.origin":{"file.name":"instance/beat.go","file.line":685},"message":"Home path: [/usr/share/filebeat] Config path: [/etc/filebeat] Data path: [/var/lib/filebeat] Logs path: [/var/log/filebeat]","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.002Z","log.origin":{"file.name":"instance/beat.go","file.line":693},"message":"Beat ID: e16db597-e376-42d2-9a88-4d36143a04ea","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.006Z","log.logger":"beat","log.origin":{"file.name":"instance/beat.go","file.line":1063},"message":"Beat info","service.name":"filebeat","system_info":{"beat":{"path":{"config":"/etc/filebeat","data":"/var/lib/filebeat","home":"/usr/share/filebeat","logs":"/var/log/filebeat"},"type":"filebeat","uuid":"e16db597-e376-42d2-9a88-4d36143a04ea"},"ecs.version":"1.6.0"}}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.006Z","log.logger":"beat","log.origin":{"file.name":"instance/beat.go","file.line":1072},"message":"Build info","service.name":"filebeat","system_info":{"build":{"commit":"045da3a1bb89944373c33332c18ca99ef6192df2","libbeat":"8.2.0","time":"2022-04-19T23:31:06.000Z","version":"8.2.0"},"ecs.version":"1.6.0"}}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.006Z","log.logger":"beat","log.origin":{"file.name":"instance/beat.go","file.line":1075},"message":"Go runtime info","service.name":"filebeat","system_info":{"go":{"os":"linux","arch":"amd64","max_procs":2,"version":"go1.17.8"},"ecs.version":"1.6.0"}}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.007Z","log.logger":"beat","log.origin":{"file.name":"instance/beat.go","file.line":1079},"message":"Host info","service.name":"filebeat","system_info":{"host":{"architecture":"x86_64","boot_time":"2022-05-13T09:32:26Z","containerized":false,"name":"ip-172-31-91-233.ec2.internal","ip":["127.0.0.1/8","::1/128","172.31.91.233/20","fe80::1015:eaff:fee0:1ab5/64"],"kernel_version":"5.10.109-104.500.amzn2.x86_64","mac":["12:15:ea:e0:1a:b5"],"os":{"type":"linux","family":"redhat","platform":"amzn","name":"Amazon Linux","version":"2","major":2,"minor":0,"patch":0,"codename":"Karoo"},"timezone":"UTC","timezone_offset_sec":0,"id":"2d99ef724dce45369047869bf2504a0b"},"ecs.version":"1.6.0"}}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.007Z","log.logger":"beat","log.origin":{"file.name":"instance/beat.go","file.line":1108},"message":"Process info","service.name":"filebeat","system_info":{"process":{"capabilities":{"inheritable":null,"permitted":["chown","dac_override","dac_read_search","fowner","fsetid","kill","setgid","setuid","setpcap","linux_immutable","net_bind_service","net_broadcast","net_admin","net_raw","ipc_lock","ipc_owner","sys_module","sys_rawio","sys_chroot","sys_ptrace","sys_pacct","sys_admin","sys_boot","sys_nice","sys_resource","sys_time","sys_tty_config","mknod","lease","audit_write","audit_control","setfcap","mac_override","mac_admin","syslog","wake_alarm","block_suspend","audit_read","38","39","40"],"effective":["chown","dac_override","dac_read_search","fowner","fsetid","kill","setgid","setuid","setpcap","linux_immutable","net_bind_service","net_broadcast","net_admin","net_raw","ipc_lock","ipc_owner","sys_module","sys_rawio","sys_chroot","sys_ptrace","sys_pacct","sys_admin","sys_boot","sys_nice","sys_resource","sys_time","sys_tty_config","mknod","lease","audit_write","audit_control","setfcap","mac_override","mac_admin","syslog","wake_alarm","block_suspend","audit_read","38","39","40"],"bounding":["chown","dac_override","dac_read_search","fowner","fsetid","kill","setgid","setuid","setpcap","linux_immutable","net_bind_service","net_broadcast","net_admin","net_raw","ipc_lock","ipc_owner","sys_module","sys_rawio","sys_chroot","sys_ptrace","sys_pacct","sys_admin","sys_boot","sys_nice","sys_resource","sys_time","sys_tty_config","mknod","lease","audit_write","audit_control","setfcap","mac_override","mac_admin","syslog","wake_alarm","block_suspend","audit_read","38","39","40"],"ambient":null},"cwd":"/var/log","exe":"/usr/share/filebeat/bin/filebeat","name":"filebeat","pid":6878,"ppid":6877,"seccomp":{"mode":"disabled","no_new_privs":false},"start_time":"2022-05-18T10:53:53.510Z"},"ecs.version":"1.6.0"}}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.007Z","log.origin":{"file.name":"instance/beat.go","file.line":325},"message":"Setup Beat: filebeat; Version: 8.2.0","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.009Z","log.logger":"add_cloud_metadata","log.origin":{"file.name":"add_cloud_metadata/add_cloud_metadata.go","file.line":105},"message":"add_cloud_metadata: hosting provider type detected as aws, metadata={\"cloud\":{\"account\":{\"id\":\"366914328259\"},\"availability_zone\":\"us-east-1d\",\"image\":{\"id\":\"ami-0022f774911c1d690\"},\"instance\":{\"id\":\"i-063a5b0a110607229\"},\"machine\":{\"type\":\"t2.medium\"},\"provider\":\"aws\",\"region\":\"us-east-1\",\"service\":{\"name\":\"EC2\"}}}","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"warn","@timestamp":"2022-05-18T10:53:55.009Z","log.logger":"cfgwarn","log.origin":{"file.name":"tlscommon/config.go","file.line":102},"message":"DEPRECATED: Treating the CommonName field on X.509 certificates as a host name when no Subject Alternative Names are present is going to be removed. Please update your certificates if needed. Will be removed in version: 8.0.0","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.010Z","log.logger":"esclientleg","log.origin":{"file.name":"eslegclient/connection.go","file.line":105},"message":"elasticsearch url: http://localhost:9200","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.014Z","log.logger":"publisher","log.origin":{"file.name":"pipeline/module.go","file.line":113},"message":"Beat name: ip-172-31-91-233.ec2.internal","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.014Z","log.logger":"modules","log.origin":{"file.name":"fileset/modules.go","file.line":108},"message":"Enabled modules/filesets: ","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.015Z","log.logger":"esclientleg","log.origin":{"file.name":"eslegclient/connection.go","file.line":105},"message":"elasticsearch url: http://localhost:9200","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.022Z","log.logger":"esclientleg","log.origin":{"file.name":"eslegclient/connection.go","file.line":287},"message":"Attempting to connect to Elasticsearch version 8.2.0","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.022Z","log.logger":"index-management","log.origin":{"file.name":"idxmgmt/std.go","file.line":231},"message":"Auto ILM enable success.","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.023Z","log.logger":"index-management.ilm","log.origin":{"file.name":"ilm/std.go","file.line":128},"message":"ILM policy filebeat successfully created.","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.023Z","log.logger":"index-management","log.origin":{"file.name":"idxmgmt/std.go","file.line":366},"message":"Set settings.index.lifecycle.name in template to {filebeat {\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_age\":\"30d\",\"max_size\":\"50gb\"}}}}}}} as ILM is enabled.","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:55.037Z","log.logger":"template","log.origin":{"file.name":"template/load.go","file.line":244},"message":"Existing template will be overwritten, as overwrite is enabled.","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:56.468Z","log.logger":"template_loader","log.origin":{"file.name":"template/load.go","file.line":158},"message":"Try loading template filebeat-8.2.0 to Elasticsearch","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:56.568Z","log.logger":"template_loader","log.origin":{"file.name":"template/load.go","file.line":126},"message":"Template with name \"filebeat-8.2.0\" loaded.","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:56.570Z","log.logger":"template_loader","log.origin":{"file.name":"template/load.go","file.line":142},"message":"Data stream with name \"filebeat-8.2.0\" already exists.","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:56.570Z","log.logger":"index-management","log.origin":{"file.name":"idxmgmt/std.go","file.line":267},"message":"Loaded index template.","service.name":"filebeat","ecs.version":"1.6.0"}
Index setup finished.
Loading dashboards (Kibana must be running and reachable)
{"log.level":"info","@timestamp":"2022-05-18T10:53:56.574Z","log.logger":"kibana","log.origin":{"file.name":"kibana/client.go","file.line":182},"message":"Kibana url: http://localhost:5601","service.name":"filebeat","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-05-18T10:53:58.466Z","log.logger":"kibana","log.origin":{"file.name":"kibana/client.go","file.line":182},"message":"Kibana url: http://localhost:5601","service.name":"filebeat","ecs.version":"1.6.0"}

Check in Elasticsearch whether the index has been created.
Create index pattern to view the same in kibana

@sudhagar_ramesh Please let me know how to check index in Elasticsearch

curl http://localhost:9200/_cat/indices?v

if the below configuration has been done then the index name whichever you in this filebeat configuration, the same index name would be seen in the output of above command.

output.elasticsearch:
  hosts: ["https://myEShost:9200"]
  username: "<elastic-cluster-username>"
  password: "<elastic-cluster-pwd>" 
  index: "<your-index-name>"

@sudhagar_ramesh

This is the output:

health status index                                uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   .ds-filebeat-8.2.0-2022.05.16-000001 1pBMuUMCSe-AJhtWpxiGVw   1   1          0            0       225b           225b

The same shown in Kibana Also

@Rajesh119
execute this command and provide the output
filebeat -e -c <you-config-file-name>

Post which you will be able to see the index in Elasticsearch

@sudhagar_ramesh

I uninstall filebeat and install again but filebeat was not started

● filebeat.service - Filebeat sends log files to Logstash or directly to Elasticsearch.
   Loaded: loaded (/usr/lib/systemd/system/filebeat.service; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Wed 2022-05-18 12:55:36 UTC; 3s ago
     Docs: https://www.elastic.co/beats/filebeat
  Process: 10787 ExecStart=/usr/share/filebeat/bin/filebeat --environment systemd $BEAT_LOG_OPTS $BEAT_CONFIG_OPTS $BEAT_PATH_OPTS (code=exited, status=1/FAILURE)
 Main PID: 10787 (code=exited, status=1/FAILURE)

May 18 12:55:36 ip-172-31-91-233.ec2.internal systemd[1]: filebeat.service: main process exited, code=exited, status=1/FAILURE
May 18 12:55:36 ip-172-31-91-233.ec2.internal systemd[1]: Unit filebeat.service entered failed state.
May 18 12:55:36 ip-172-31-91-233.ec2.internal systemd[1]: filebeat.service failed.
May 18 12:55:36 ip-172-31-91-233.ec2.internal systemd[1]: filebeat.service holdoff time over, scheduling restart.
May 18 12:55:36 ip-172-31-91-233.ec2.internal systemd[1]: Stopped Filebeat sends log files to Logstash or directly to Elasticsearch..
May 18 12:55:36 ip-172-31-91-233.ec2.internal systemd[1]: start request repeated too quickly for filebeat.service
May 18 12:55:36 ip-172-31-91-233.ec2.internal systemd[1]: Failed to start Filebeat sends log files to Logstash or directly to Elasticsearch..
May 18 12:55:36 ip-172-31-91-233.ec2.internal systemd[1]: Unit filebeat.service entered failed state.
May 18 12:55:36 ip-172-31-91-233.ec2.internal systemd[1]: filebeat.service failed.