Error on filebeat

Capturar
My elasticsearch and kibana is ok but by filebeat doesn't work but when i do filebeat test config say its ok.
Any suggestions for resolve this problem?
Thank you.

Welcome to the community @VitorBarroso !
Can you paste your full filebeat.yml configuration?

###################### 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: filestream

  # 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: true

  # 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"]

# 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: "http://192.168.100.50: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: ["http://192.168.100.50:9200"]

  # Protocol - either `http` (default) or `https`.
  protocol: "http"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "elastic"
  password: "zJo*18IY3gqAZ_bn*GpQ"

  ssl:
    enable: true
    ca_trusted_fingerprint: "1c293074c286f65f9a5c0db80419de085b264c1341b539c54bf7032f734f3093"
# ------------------------------ Logstash Output -------------------------------
#output.logstash:
  # The Logstash hosts
  #hosts: ["localhost:5044"]

  # 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

Is Elasticsearch reachable in the address you are using? What is the output of curl http://192.168.100.50:9200 ?

curl: (52) Empty reply from server

There is your problem, Elasticsearch is not up

The elasticsearch service its working
I run systemctl status elasticsearch.service and the response is active (running)

Maybe Elasticsearch is not bound to 192.168.100.50, therefore only responding to localhost ?

What is your elasticsearch.yml configured, specifically the network.host (which defaults to _local_) ?

Loos like you are trying to use ssl so you should use https

That is often the response when sending http to https port so try

curl -insecure -u "elastic:zJo*18IY3gqAZ_bn*GpQ" https://192.168.100.50:9200

and you should reset your password since you posted it here

So try this..

# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["https://192.168.100.50:9200"] <!------ HERE

  # Protocol - either `http` (default) or `https`.
  protocol: "https"  <!------ HERE

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "elastic"
  password: "zJo*18IY3gqAZ_bn*GpQ"

  ssl:
    enable: true
    ca_trusted_fingerprint: "1c293074c286f65f9a5c0db80419de085b264c1341b539c54bf7032f734f3093"


But when i do systemctl status filebeat.service i have this errors
filebeat.service - Filebeat sends log files to Logstash or directly to Elasticsearch.
Loaded: loaded (/lib/systemd/system/filebeat.service; disabled; vendor preset: enabled)
Active: active (running) since Fri 2022-08-05 10:22:32 WEST; 13min ago
Docs: Filebeat: Lightweight Log Analysis & Elasticsearch | Elastic
Main PID: 1468 (filebeat)
Tasks: 19 (limit: 4678)
Memory: 66.0M
CPU: 3.511s
CGroup: /system.slice/filebeat.service
└─1468 /usr/share/filebeat/bin/filebeat --environment systemd -c /etc/filebeat/filebeat.yml --path.home /usr/share/filebeat --path.config /etc/filebeat --path.data>

Aug 05 10:34:24 debian filebeat[1468]: {"log.level":"error","@timestamp":"2022-08-05T10:34:24.878+0100","log.logger":"input.httpjson-cursor","log.origin":{"file.name":
"httpjson/input.go","file.line":128},"message":"Error while processing http request: failed to execute rf.collectResponse: failed to execute http client.Do:
failed to execute http client.Do: Post "https://SERVER/events/restSearch\": POST https://SERVER/events/restSearch giving up after 6 attempts",
"service.name":"filebeat","id":"D55804D5C3C8CDA3","input_source":"https://SERVER/events/restSearch","input_url":"https://SERVER/events/restSearch","ecs.version":"1.6.0"}

Aug 05 10:34:37 debian filebeat[1468]: {"log.level":"info","@timestamp":"2022-08-05T10:34:37.026+0100","log.logger":"monitoring","log.origin":{"file.name":
"log/log.go","file.line":185},"message":"Non-zero metrics in the last 30s","service.name":"filebeat","monitoring":{"metrics":{"beat":{"cgroup":
{"memory":{"mem":{"usage":{"bytes":3194880}}}},"cpu":{"system":{"ticks":720,"time":{"ms":10}},"total":{"ticks":3440,"time":{"ms":50},"value":0},
"user":{"ticks":2720,"time":{"ms":40}}},"handles":{"limit":{"hard":524288,"soft":1024},"open":28},"info":{"ephemeral_id":"18b62384-bbbd-484e-a5dd-cfa95df9bad0",
"uptime":{"ms":708315},"version":"8.3.3"},"memstats":{"gc_next":46615272,"memory_alloc":40784424,"memory_total":479586400,"rss":76115968},
"runtime":{"goroutines":91}},"filebeat":{"events":{"active":-1454,"added":7,"done":1461},"harvester":{"open_files":0,"running":0}},
"libbeat":{"config":{"module":{"running":1},"scans":3},"output":{"events":{"acked":19,"active":0,"batches":34,"duplicates":1492,"total":1461},
"read":{"bytes":558702},"write":{"bytes":1776382}},"pipeline":{"clients":23,"events":{"active":0,"published":7,"total":7},"queue":{"acked":1511}}},
"registrar":{"states":{"current":0}},"system":{"load":{"1":0.19,"15":1.62,"5":1.35,"norm":{"1":0.0475,"15":0.405,"5":0.3375}}}},"ecs.version":"1.6.0"}}

Aug 05 10:34:50 debian filebeat[1468]: {"log.level":"error","@timestamp":"2022-08-05T10:34:50.719+0100","log.logger":"input.httpjson-cursor.retryablehttp",
"log.origin":{"file.name":"go-retryablehttp@v0.6.6/client.go","file.line":553},"message":"request failed","service.name":"filebeat","id":"6C0CE24E328214C4",
"input_source":"https://www.threatq.com/api/indicators/query/hash/INSERT_THREATQ_DATA_COLLECTION_ID","input_url":
"https://www.threatq.com/api/indicators/query/hash/INSERT_THREATQ_DATA_COLLECTION_ID","error":{"message":"Post "https://www.threatq.com/api/token\":
net/http: request canceled (Client.Timeout exceeded while awaiting headers)"},"method":"POST","url":"https://www.threatq.com/api/token","ecs.version":"1.6.0"}

Aug 05 10:35:07 debian filebeat[1468]: {"log.level":"info","@timestamp":"2022-08-05T10:35:07.027+0100","log.logger":"monitoring","log.origin":{"file.name":
"log/log.go","file.line":185},"message":"Non-zero metrics in the last 30s","service.name":"filebeat","monitoring":{"metrics":{"beat":{"cgroup":
{"memory":{"mem":{"usage":{"bytes":454656}}}},"cpu":{"system":{"ticks":720},"total":{"ticks":3450,"time":{"ms":10},"value":0},"user":{"ticks":2730,"time":{"ms":10}}},
"handles":{"limit":{"hard":524288,"soft":1024},"open":28},"info":{"ephemeral_id":"18b62384-bbbd-484e-a5dd-cfa95df9bad0","uptime":{"ms":738317},"version":"8.3.3"},
"memstats":{"gc_next":46615272,"memory_alloc":41365720,"memory_total":480167696,"rss":76386304},"runtime":{"goroutines":90}},"filebeat":
{"events":{"added":2,"done":2},"harvester":{"open_files":0,"running":0}},"libbeat":{"config":{"module":{"running":1},"scans":3},
"output":{"events":{"acked":2,"active":0,"batches":2,"total":2},"read":{"bytes":717},"write":{"bytes":4575}},"pipeline":{"clients":23,"events":
{"active":0,"published":2,"total":2},"queue":{"acked":2}}},"registrar":{"states":{"current":0}},"system":{"load":{"1":0.12,"15":1.57,"5":1.22,
"norm":{"1":0.03,"15":0.3925,"5":0.305}}}},"ecs.version":"1.6.0"}}

Aug 05 10:35:36 debian filebeat[1468]: {"log.level":"error","@timestamp":"2022-08-05T10:35:36.721+0100","log.logger":"input.httpjson-cursor.retryablehttp",
"log.origin":{"file.name":"go-retryablehttp@v0.6.6/client.go","file.line":553},"message":"request failed","service.name":"filebeat",
"id":"6C0CE24E328214C4","input_source":"https://www.threatq.com/api/indicators/query/hash/INSERT_THREATQ_DATA_COLLECTION_ID",
"input_url":"https://www.threatq.com/api/indicators/query/hash/INSERT_THREATQ_DATA_COLLECTION_ID",
"error":{"message":"Post "https://www.threatq.com/api/token\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"},
"method":"POST","url":"https://www.threatq.com/api/token","ecs.version":"1.6.0"}

Aug 05 10:35:36 debian filebeat[1468]: {"log.level":"error","@timestamp":"2022-08-05T10:35:36.721+0100","log.logger":"input.httpjson-cursor","log.origin":
{"file.name":"httpjson/input.go","file.line":128},"message":"Error while processing http request: failed to execute rf.collectResponse:
failed to execute http client.Do: failed to execute http client.Do:
Get "https://www.threatq.com/api/indicators/query/hash/INSERT_THREATQ_DATA_COLLECTION_ID?cursorMark=*&limit=100&sort=updated_at\":
Post "https://www.threatq.com/api/token\": POST https://www.threatq.com/api/token giving up after 6 attempts","service.name":"filebeat",
"id":"6C0CE24E328214C4","input_source":"https://www.threatq.com/api/indicators/query/hash/INSERT_THREATQ_DATA_COLLECTION_ID",
"input_url":"https://www.threatq.com/api/indicators/query/hash/INSERT_THREATQ_DATA_COLLECTION_ID","ecs.version":"1.6.0"}

Aug 05 10:35:36 debian filebeat[1468]: {"log.level":"info","@timestamp":"2022-08-05T10:35:36.721+0100","log.logger":"input.httpjson-cursor","log.origin":
{"file.name":"httpjson/input.go","file.line":125},"message":"Process another repeated request.","service.name":"filebeat",
"id":"6C0CE24E328214C4","input_source":"https://www.threatq.com/api/indicators/query/hash/INSERT_THREATQ_DATA_COLLECTION_ID",
"input_url":"https://www.threatq.com/api/indicators/query/hash/INSERT_THREATQ_DATA_COLLECTION_ID","ecs.version":"1.6.0"}

Aug 05 10:35:37 debian filebeat[1468]: {"log.level":"info","@timestamp":"2022-08-05T10:35:37.026+0100","log.logger":"monitoring","log.origin":
{"file.name":"log/log.go","file.line":185},"message":"Non-zero metrics in the last 30s","service.name":"filebeat","monitoring":{"metrics":
{"beat":{"cgroup":{"memory":{"mem":{"usage":{"bytes":602112}}}},"cpu":{"system":{"ticks":730,"time":{"ms":10}},"total":{"ticks":3470,"time":{"ms":20},"value":0},
"user":{"ticks":2740,"time":{"ms":10}}},"handles":{"limit":{"hard":524288,"soft":1024},"open":28},"info":{"ephemeral_id":"18b62384-bbbd-484e-a5dd-cfa95df9bad0",
"uptime":{"ms":768316},"version":"8.3.3"},"memstats":{"gc_next":46615272,"memory_alloc":42129416,"memory_total":480931392,"rss":77213696},"runtime":{"goroutines":90}},
"filebeat":{"events":{"added":1,"done":1},"harvester":{"open_files":0,"running":0}},"libbeat":{"config":{"module":{"running":1},"scans":3},"output":{"events":
{"acked":1,"active":0,"batches":1,"total":1},"read":{"bytes":359},"write":{"bytes":2569}},"pipeline":{"clients":23,"events":{"active":0,"published":1,"total":1},
"queue":{"acked":1}}},"registrar":{"states":{"current":0}},"system":{"load":{"1":0.07,"15":1.52,"5":1.1,"norm":{"1":0.0175,"15":0.38,"5":0.275}}}},"ecs.version":"1.6.0"}}

Aug 05 10:36:06 debian filebeat[1468]: {"log.level":"error","@timestamp":"2022-08-05T10:36:06.722+0100","log.logger":"input.httpjson-cursor.retryablehttp",
"log.origin":{"file.name":"go-retryablehttp@v0.6.6/client.go","file.line":553},"message":"request failed","service.name":"filebeat","id":"6C0CE24E328214C4",
"input_source":"https://www.threatq.com/api/indicators/query/hash/INSERT_THREATQ_DATA_COLLECTION_ID",
"input_url":"https://www.threatq.com/api/indicators/query/hash/INSERT_THREATQ_DATA_COLLECTION_ID","error":{"message":
"Post "https://www.threatq.com/api/token\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"},"method":"POST",
"url":"https://www.threatq.com/api/token","ecs.version":"1.6.0"}

Aug 05 10:36:07 debian filebeat[1468]: {"log.level":"info","@timestamp":"2022-08-05T10:36:07.026+0100","log.logger":"monitoring","log.origin":
{"file.name":"log/log.go","file.line":185},"message":"Non-zero metrics in the last 30s","service.name":"filebeat","monitoring":{"metrics":{"beat":{"cgroup":{"memory":
{"mem":{"usage":{"bytes":-12886016}}}},"cpu":{"system":{"ticks":730},"total":{"ticks":3490,"time":{"ms":20},"value":0},"user":{"ticks":2760,"time":{"ms":20}}},
"handles":{"limit":{"hard":524288,"soft":1024},"open":27},"info":{"ephemeral_id":"18b62384-bbbd-484e-a5dd-cfa95df9bad0","uptime":{"ms":798316},"version":"8.3.3"},
"memstats":{"gc_next":36397576,"memory_alloc":17606040,"memory_total":481566528,"rss":64589824},"runtime":{"goroutines":88}},"filebeat":{"events":{"added":4,"done":4},
"harvester":{"open_files":0,"running":0}},"libbeat":{"config":{"module":{"running":1},"scans":3},"output":{"events":{"acked":4,"active":0,"batches":1,"total":4},
"read":{"bytes":1010},"write":{"bytes":7108}},"pipeline":{"clients":23,"events":{"active":0,"published":4,"total":4},"queue":{"acked":4}}},"registrar":
{"states":{"current":0}},"system":{"load":{"1":0.04,"15":1.47,"5":1,"norm":{"1":0.01,"15":0.3675,"5":0.25}}}},"ecs.version":"1.6.0"}}

Sorry for the formatation and thanks one more time.

Hmm right there is your logs...Looks like your input is failing ... timeout when trying

[https://www.threatq.com/api/indicators/query/hash/INSERT_THREATQ_DATA_COLLECTION_ID","error":{"message":"Post]
...Client.Timeout exceeded while awaiting headers)"},"method":"POST","url":"[https://www.threatq.com/api/token","ecs.version":"1.6.0]

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.