Logstash error during configuration

When i Run ./logstash -f logstash-simple.conf then it's give me an error like this,

Using bundled JDK: /usr/share/logstash/jdk
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
Could not find log4j2 configuration at path /usr/share/logstash/config/log4j2.properties. Using default config which logs errors to the console
[INFO ] 2022-02-01 13:16:34.854 [main] runner - Starting Logstash {"logstash.version"=>"7.16.3", "jruby.version"=>"jruby 9.2.20.1 (2.5.8) 2021-11-30 2a2962fbd1 OpenJDK 64-Bit Server VM 11.0.13+8 on 11.0.13+8 +indy +jit [linux-x86_64]"}
Your settings are invalid. Reason: Path "/usr/share/logstash/data" must be a writable directory. It is not writable.
[FATAL] 2022-02-01 13:16:34.898 [main] Logstash - Logstash stopped processing because of an error: (SystemExit) exit
org.jruby.exceptions.SystemExit: (SystemExit) exit
	at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:747) ~[jruby-complete-9.2.20.1.jar:?]
	at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:710) ~[jruby-complete-9.2.20.1.jar:?]
	at usr.share.logstash.lib.bootstrap.environment.<main>(/usr/share/logstash/lib/bootstrap/environment.rb:94) ~[?:?]

i run this cmd in /usr/share/logstash/bin directory

i want to configure json file log in Elasticsearch so what is the proper way to do it with logstash ?

Here is a conf file -

input {
  file {
    type => "json"
    path => "/home/harsh/Documents/log/data.json"
    start_position => "beginning"
    sincedb_path => "/dev/null"
  }
}

filter {

}

output {
  stdout { codec => json}
  elasticsearch{
	hosts => ["localhost:9200"]
	user => elastic
    password => elastic
    index => "logstash"
    document_type => "json"
  }
}

> WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
> Could not find log4j2 configuration at path /usr/share/logstash/config/log4j2.properties. Using default config which logs errors to the console

If you installed from .rpm, you should run like:
/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/logstash.conf --path.settings /etc/logstash/
Optionally use " -t " at the end to test logstash.conf configuration.

I don't understand what was you try to explained, can you explain in brief ?

How you start logstash, as process or service? Path to configuration location is not visible. If you start as process, add: --path.settings /etc/logstash/

okay can you just tell me in which path i have to change the configuration for Elasticsearch.

Do you have any reference link for connection between Elasticsearch and logstash ?

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