Filebeat not connected to Logstash as per my understanding

(Ashvin) #1


I have configured filebeat to harvest logs from a certain path. And the same logs can be discovered in Kibana. However, I wanted to parse the logs which is obtained in message field in kibana. For that I was trying to use Logstash confgurations. In that I have specified port as 5044 for input under assumption that the input from filebeats will reach logstash (Is my assumption correct?). If yes, how can I confirm whether the data has reached logstash. I am using grok filter in logstash to parse the incoming log file.

(Ashvin) #2


Sample Logstash configuration for creating a simple

Beats -> Logstash -> Elasticsearch pipeline.


beats {
port =>5044



match => { "message" => "%{TIMESTAMP_ISO8601:ASHVIN}"}


output {
elasticsearch {
hosts => ["http://localhost:9200"]
manage_template => false
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"

stdout {}

(Ashvin) #3

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

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

configuration file.

#=========================== 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.

  • type: log

    Change to true to enable this input configuration.

    enabled: true

    Paths that should be crawled and fetched. Glob based paths.

    #- /var/log/*.log

    • C:\SCMRepos\PetroVault\Log\Security*.log

    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$']

    Optional additional fields. These fields can be freely picked

    to add additional information to the crawled log files for filtering


    level: debug

    review: 1

    Multiline options

    Multiline can be used for log messages spanning multiple lines. This is common

    for Java Stack Traces or C-Line Continuation

    The regexp Pattern that has to be matched. The example pattern matches all lines starting with [

    #multiline.pattern: ^[

    Defines if the pattern set under pattern should be negated or not. Default is false.

    #multiline.negate: false

    Match can be set to "after" or "before". It is used to define if lines should be append to a pattern

    that was (not) matched before or after or as long as a pattern is not matched based on negate.

    Note: After is the equivalent to previous and before is the equivalent to to next in Logstash

    #multiline.match: after

#============================= Filebeat 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 ==========================

index.number_of_shards: 3
#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.


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



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 CLI flag or the setup command.

setup.dashboards.enabled: true

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



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

Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.

This requires a Kibana endpoint configuration.


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.

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

These settings simplify using filebeat with the Elastic Cloud (

The setting overwrites the output.elasticsearch.hosts and options.

You can find the in the Elastic Cloud web UI.

The cloud.auth setting overwrites the output.elasticsearch.username and

output.elasticsearch.password settings. The format is <user>:<pass>.


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

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

#-------------------------- Elasticsearch output ------------------------------

Array of hosts to connect to.

#hosts: ["localhost:9200"]
#pipeline: test

Optional protocol and basic auth credentials.

#protocol: "https"
#username: "elastic"
#password: "changeme"

#----------------------------- Logstash output --------------------------------
#The Logstash hostss
hosts: ["localhost:9601"]

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"

#================================ Procesors =====================================

Configure processors to enhance or manipulate events generated by the beat.


  • add_host_metadata: ~
  • add_cloud_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",

"publish", "service".

#logging.selectors: ["*"]

(Christian Dahlqvist) #4

This does not seem to match, which might explain why you are seeing connection problems.

(Ashvin) #5

Hiii Christian... Yes thanks for noting that.. actually, I had given the same port connection initially.. but later I changed it for troubleshooting..

Please find the following output:-
C:\Program Files\Filebeat>filebeat test output
logstash: localhost:9600...
parse host... OK
dns lookup... OK
addresses: ::1,
dial up... ERROR dial tcp [::1]:9600: connectex: No connection could be made because the target machine actively refused it.

I understand that the filebeat to logstash connection is not established.

Also please note that in logstash.config:-

Sample Logstash configuration for creating a simple

Beats -> Logstash -> Elasticsearch pipeline.


beats {
port =>5044



match => { "message" => "%{TIMESTAMP_ISO8601:ASHVIN}"}


output {
elasticsearch {
hosts => ["http://localhost:9200"]
manage_template => false
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"

stdout {}

input to logstash is defined at port 5044.. is this the right port for filebeat??

(Christian Dahlqvist) #6

Yes, you should specify the port used in the beats input plugin (5044), not 9600.

(Ashvin) #7

But when i try to ping port 5044 or either try accessing the port 5044, I am unable to do that

(Ashvin) #8

what can i understand from that?