Tag Archives: Logstash Error

[Solved] Logstash Error: Logstash – java.lang.IllegalStateException: Logstash stopped processing because of an err

I recently tried to use Elasticsearch and IK in combination with Logstash to link mysql, and tested Logstash with the following error message.

First enter the command: logstash -e ‘input {stdin{}} output {stdout{}}’

D:\myworkspace\es\logstash-6.4.3\bin>logstash -e 'input {stdin{}} output {stdout{}}'

The command is correct, but the result is:

D:\myworkspace\es\logstash-6.4.3\bin>logstash -e 'input {stdin{}} output {stdout{}}'
ERROR: Unknown command '{stdin{}}'

See: 'bin/logstash --help'
[ERROR] 2022-08-23 09:06:42.875 [main] Logstash - java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit) exit

 

Solution:

You should try the following command first:

logstash -e “”

The result was successful:

D:\myworkspace\es\logstash-6.4.3\bin>logstash -e ""
Sending Logstash logs to D:/myworkspace/es/logstash-6.4.3/logs which is now configured via log4j2.properties
[2022-08-23T09:16:16,950][INFO ][logstash.setting.writabledirectory] Creating directory {:setting=>"path.queue", :path=>"D:/myworkspace/es/logstash-6.4.3/data/queue"}
[2022-08-23T09:16:16,958][INFO ][logstash.setting.writabledirectory] Creating directory {:setting=>"path.dead_letter_queue", :path=>"D:/myworkspace/es/logstash-6.4.3/data/dead_letter_queue"}
[2022-08-23T09:16:17,054][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2022-08-23T09:16:17,164][INFO ][logstash.agent           ] No persistent UUID file found. Generating new UUID {:uuid=>"0777ac0f-9efb-463d-8e2c-874bc1dc9feb", :path=>"D:/myworkspace/es/logstash-6.4.3/data/uuid"}
[2022-08-23T09:16:17,592][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"6.4.3"}
[2022-08-23T09:16:20,129][INFO ][logstash.pipeline        ] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>8, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
[2022-08-23T09:16:20,231][INFO ][logstash.pipeline        ] Pipeline started successfully {:pipeline_id=>"main", :thread=>"#<Thread:0x5fba80a0 run>"}
The stdin plugin is now waiting for input:
[2022-08-23T09:16:20,277][INFO ][logstash.agent           ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[2022-08-23T09:16:20,611][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
[2022-08-23T09:16:43,203][WARN ][logstash.runner          ] SIGINT received. Shutting down.
[2022-08-23T09:16:43,338][INFO ][logstash.pipeline        ] Pipeline has terminated {:pipeline_id=>"main", :thread=>"#<Thread:0x5fba80a0 run>"}
[2022-08-23T09:16:43,340][FATAL][logstash.runner          ] SIGINT received. Terminating immediately.

Decisively replace with the following command:

logstash -e "input { stdin {} }  output {stdout {} }"

Done!

D:\myworkspace\es\logstash-6.4.3\bin>logstash -e "input { stdin {} }  output {stdout {} }"
Sending Logstash logs to D:/myworkspace/es/logstash-6.4.3/logs which is now configured via log4j2.properties
[2022-08-23T09:17:48,125][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2022-08-23T09:17:48,690][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"6.4.3"}
[2022-08-23T09:17:50,871][INFO ][logstash.pipeline        ] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>8, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
[2022-08-23T09:17:50,964][INFO ][logstash.pipeline        ] Pipeline started successfully {:pipeline_id=>"main", :thread=>"#<Thread:0x268e4bb5 run>"}
The stdin plugin is now waiting for input:
[2022-08-23T09:17:51,008][INFO ][logstash.agent           ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[2022-08-23T09:17:51,209][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}

How to Solve Logstash error: failed to execute action

Logstash error failed to execute action

The main reason why most of them report this error is that the conf file configuration is written incorrectly

input {
    stdin {
    }
    jdbc {
      # mysql database connection
      jdbc_connection_string => "jdbc:mysql://127.0.0.1:3306/itripdb?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC"
      # mysqly username and password
      jdbc_user => "root"
      jdbc_password => ""
      # Driver configuration Here fill in your own mysql-connector-java-8.0.13.jar path
      jdbc_driver_library => "D:\soft\Elasticsearch\logstash-7.9.3\logstash-7.9.3\bin\mysql-connector-java-8.0.13.jar"
      # Driver class name
      jdbc_driver_class => "com.mysql.jdbc.Driver"
      jdbc_paging_enabled => "true"
      # Specify to display 300000 entries per page
      jdbc_page_size => "300000"
      # Execute the specified sql file
 
     # The sql statement to be executed
       statement => "SELECT * FROM itrip_hotel"
      # Set listen to the meaning of each field minute hour day month year, default all * means: updated every minute
      schedule => "* * * * * *"
      # index type
      # type => ""
    }
}
 
 
output {
 
    elasticsearch {
        #es server
        hosts => ["localhost:9200"]
        #ES index name
        index => "itrip_hotel"
        #primary key self-incrementing ID
        document_id => "%{id}"
    }
    
    #Set json format
    stdout {
        codec => json_lines
    }
}

[Solved] Logstash Error: Bad file descriptor

no errors in the startup log using bin/logstash-f config/D_HINFO_PDT.conf.
When I use nohup bin/logstash-f config/D_HINFO_PDT.conf & startup.
Every second the following error is reported.
2017-10-30T10:52:13,412][ERROR][logstash.pipeline        ] A plugin had an unrecoverable error. Will restart this plugin.
Plugin: <LogStash::Inputs::Stdin id=>”d82cf8f6e66e1ce48c50c9d2d840029f3296238a-1″, enable_metric=>true, codec=><LogStash::Codecs::Line id=>”line_6e3830b8-b4c6-4fb8-b15c-27356ae29021″, enable_metric=>true, charset=>”UTF-8″, delimiter=>”\n”>>
Error: Bad file descriptor – Bad file descriptor 

 

Solution: When bin/logstash is started directly, there is a plugin to read data from stdin.
Once the nohup is used, it means that stdin is empty, so it will naturally report bad file descriptor error.
To solve this, one is to install logstash as a service, and the other is to add a parameter at startup.

nohup bin/logstash -f config/D_HINFO_PDT.conf 0</dev/null &