Kibana do not see logstash and filebeat

Hi,

I have just installed ELK and got this mistake in Kibana. Could anyone help me?

filebeat.yml

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

filebeat.prospectors:

# 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.
  paths:
    - /var/log/secure
    - /var/log/messages
   #- /var/log/*.log

    #- c:\programdata\elasticsearch\logs\*
  fields:
    type: syslog
  # 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
  #fields:
  #  level: debug
  #  review: 1

  ### Multiline options

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

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: 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.
#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` CLI flag or 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"

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

  # Optional protocol and basic auth credentials.
  #protocol: "https"
  #username: "elastic"
  #password: "changeme"

#----------------------------- Logstash output --------------------------------
output.logstash:
  # The Logstash hosts
  hosts: ["localhost:5044"]
  bulk_max_size: 1024

  # Optional SSL. By default is off.
  # List of root certificates for HTTPS server verifications
  ssl.certificate_authorities: ["/etc/pki/tls/certs/logstash-forwarder.crt"]
                         
  # Certificate for SSL client authentication
  #ssl.certificate: "/etc/pki/client/cert.pem"

  # Client Certificate Key
  ssl.key: "/etc/pki/tls/private/logstash-forwarder.key"

I am using: CentOS 7, Kibana 6.3, Logstash 6.3, ES 6.3

After http://localhost:9200/_cat/indices
green open .kibana erFP_Zj-ScepiccFzNQWcg 1 0 154 16 187.4kb 187.4kb
green open .monitoring-kibana-6-2018.07.19 M9yF2dULSvKg_N2HMRjyJw 1 0 843 0 573.6kb 573.6kb
yellow open shakespeare 5s46tMB6SzqFADTlFfQ42A 5 1 0 0 1.2kb 1.2kb
green open .monitoring-es-6-2018.07.18 RlsSm8wDTf-guUjP0Y6Sdw 1 0 20851 165 8.4mb 8.4mb
yellow open test kvOmMOB-RiK1Qk_L2nnWrw 5 1 2 0 7.8kb 7.8kb
green open .monitoring-kibana-6-2018.07.18 -x_2kTbmTlOGNG61VIEzMA 1 0 2183 0 753.1kb 753.1kb
green open .monitoring-es-6-2018.07.19 0ikjxVFYR8GDX4v_9ZaCMQ 1 0 35059 175 23.9mb 23.9mb
yellow open xxxx cmOdTNrCTVabrowhRAdrAQ 5 1 0 0 1.2kb 1.2kb

My logstash.conf

input {
 beats {
   port => 5044
   ssl => true
   ssl_certificate => "/etc/pki/tls/certs/logstash-forwarder.crt"
   ssl_key => "/etc/pki/tls/private/logstash-forwarder.key"
   congestion_threshold => "40"
  }
}

filter {
if [type] == "syslog" {
    grok {
      match => { "message" => "%{SYSLOGLINE}" }
    }

    date {
match => [ "timestamp", "MMM  d HH:mm:ss", "MMM dd HH:mm:ss" ]
}
  }

}

output {
 elasticsearch {
  hosts => localhost
    index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
       }
stdout {
    codec => rubydebug
       }
}
~                                                                                                                                                     
~

On first glance, it looks like you need to add port 9200 to the logstash.conf elasticsearch output.

Elasticsearch isn't getting our logs so we know the problem is somewhere between logstash and filebeat. Do the logs in filebeat or logstash give any indication of errors?

Here is a filebeat log

2018-07-19T16:00:46.023+0200    INFO    [monitoring]    log/log.go:124  Non-zero metrics in the last 30s        {"monitoring": {"metrics": {"beat":{"cpu":{"system":{"ticks":440,"time":{"ms":3}},"total":{"ticks":900,"time":{"ms":5},"value":900},"user":{"ticks":460,"time":{"ms":2}}},"info":{"ephemeral_id":"5ae5ff9c-9399-433a-bb87-b4881e26c736","uptime":{"ms":4824234}},"memstats":{"gc_next":4194304,"memory_alloc":1948824,"memory_total":32318760}},"filebeat":{"harvester":{"open_files":0,"running":0}},"libbeat":{"config":{"module":{"running":0}},"pipeline":{"clients":0,"events":{"active":0}}},"registrar":{"states":{"current":0}},"system":{"load":{"1":3.67,"15":4.12,"5":3.85,"norm":{"1":0.9175,"15":1.03,"5":0.9625}}}}}}
2018-07-19T16:01:08.516+0200    INFO    beater/filebeat.go:420  Stopping filebeat
2018-07-19T16:01:08.569+0200    INFO    crawler/crawler.go:109  Stopping Crawler
2018-07-19T16:01:08.569+0200    INFO    crawler/crawler.go:119  Stopping 0 inputs
2018-07-19T16:01:08.587+0200    INFO    cfgfile/reload.go:217   Dynamic config reloader stopped
2018-07-19T16:01:08.588+0200    INFO    crawler/crawler.go:135  Crawler stopped
2018-07-19T16:01:08.595+0200    INFO    registrar/registrar.go:247      Stopping Registrar
2018-07-19T16:01:08.595+0200    INFO    registrar/registrar.go:173      Ending Registrar
2018-07-19T16:01:08.827+0200    INFO    [monitoring]    log/log.go:132  Total non-zero metrics  {"monitoring": {"metrics": {"beat":{"cpu":{"system":{"ticks":450,"time":{"ms":455}},"total":{"ticks":920,"time":{"ms":926},"value":920},"user":{"ticks":470,"time":{"ms":471}}},"info":{"ephemeral_id":"5ae5ff9c-9399-433a-bb87-b4881e26c736","uptime":{"ms":4847037}},"memstats":{"gc_next":4194304,"memory_alloc":2138592,"memory_total":32508528,"rss":8736768}},"filebeat":{"harvester":{"open_files":0,"running":0}},"libbeat":{"config":{"module":{"running":0},"reloads":1},"output":{"type":"elasticsearch"},"pipeline":{"clients":0,"events":{"active":0}}},"registrar":{"states":{"current":0},"writes":{"success":1,"total":1}},"system":{"cpu":{"cores":4},"load":{"1":4.02,"15":4.13,"5":3.92,"norm":{"1":1.005,"15":1.0325,"5":0.98}}}}}}
2018-07-19T16:01:08.830+0200    INFO    [monitoring]    log/log.go:133  Uptime: 1h20m47.039816566s
2018-07-19T16:01:08.830+0200    INFO    [monitoring]    log/log.go:110  Stopping metrics logging.
2018-07-19T16:01:08.837+0200    INFO    instance/beat.go:321    filebeat stopped.

logstash-plain.log

[2018-07-19T21:56:33,013][FATAL][logstash.runner          ] An unexpected error occurred! {:error=>#<ArgumentError: Path "/var/lib/logstash/queue" must be a writable directory. It is not writable.>, :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/settings.rb:448:in `validate'", "/usr/share/logstash/logstash-core/lib/logstash/settings.rb:230:in `validate_value'", "/usr/share/logstash/logstash-core/lib/logstash/settings.rb:141:in `block in validate_all'", "org/jruby/RubyHash.java:1343:in `each'", "/usr/share/logstash/logstash-core/lib/logstash/settings.rb:140:in `validate_all'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:279:in `execute'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:67:in `run'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:238:in `run'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:132:in `run'", "/usr/share/logstash/lib/bootstrap/environment.rb:73:in `<main>'"]}
[2018-07-19T21:56:33,063][ERROR][org.logstash.Logstash    ] java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit) exit

could you please take a look on logs?

Cool, filebeat looks like it's running fine. Logstash not so much.

Logstash has a persistent event queue that is trying to write to /var/lib/logstash but it doesn't have permissions for that folder. Can you check ls -lah /var/lib/logstash? Maybe reinstalling logstash?

I have such permissions

    ls -lah /var/lib/logstash
    total 24K
    drwxrwxr-x.  5 logstash      logstash      4.0K Jun 30 00:46 .
    drwxr-xr-x. 86 root          root          4.0K Jul 18 12:36 ..
    drwxr-xr-x.  2 elasticsearch elasticsearch 4.0K Jul 17 10:28 dead_letter_queue
    -rw-r--r--.  1 elasticsearch elasticsearch    0 Jul 17 10:28 .lock
    drwxr-xr-x.  3 elasticsearch elasticsearch 4.0K Jul 18 12:01 plugins
    drwxrwxrwx.  2 elasticsearch elasticsearch 4.0K Jul 17 10:28 queue
    -rw-r--r--.  1 elasticsearch elasticsearch   36 Jul 17 10:28 uuid

Ah.

[Unit]
Description=logstash

[Service]
Type=simple
User=logstash
Group=logstash

The logstash service runs as user and group logstash. This folder needs to be owned by them for the service to start. Is it possible permissions for this were changed accidentally?

I have like this
[Unit]
Description=logstash

[Service]
Type=simple
User=logstash
Group=logstash
# Load env vars from /etc/default/ and /etc/sysconfig/ if they exist.
# Prefixing the path with '-' makes it try to load, but if the file doesn't
# exist, it continues onward.
EnvironmentFile=-/etc/default/logstash
EnvironmentFile=-/etc/sysconfig/logstash
ExecStart=/usr/share/logstash/bin/logstash "--path.settings" "/etc/logstash"
Restart=always
WorkingDirectory=/
Nice=19
LimitNOFILE=16384

[Install]
WantedBy=multi-user.target

I see that all in a folder/etc/systemd/system belongs to root, do i need to change it? On what? Thanks

The permissions for the systemd files are fine. chown the /etc/logstash directory and all its files so that it belongs to the logstash user and group, as per @jbudz's hint.

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