logstash-plugins/logstash-output-google_bigquery

EACCES permission denied on File.delete

Closed this issue · 1 comments

This error in logstash.err followed by logstash stopping.
Logstash 2.2.0 on CentOS 7.1.1503

Errno::EACCES: Permission denied - /opt/logstash-temp//logstash_bq_2016-02-19.part019.log
              unlink at org/jruby/RubyFile.java:1156
  initialize_deleter at /opt/logstash/vendor/local_gems/618b6e33/logstash-output-google_bigquery-2.0.3/lib/logstash/outputs/google_bigquery.rb:314

The relevant lines of code (the File.delete call)

        when "DONE"
          if job_status.has_key?("errorResult")
            @logger.error("BQ: job failed, please enable debug and check full "\
                          "response (probably the issue is an incompatible "\
                          "schema). NOT deleting local file.",
                          :job_id => job_id,
                          :filename => filename,
                          :job_status => job_status)
          else
            @logger.debug("BQ: job is done, deleting local temporary file ",
                          :job_id => job_id,
                          :filename => filename,
                          :job_status => job_status)
            File.delete(filename) if File.exist?(filename)
          end

logstash user owns the directory and files so not sure why it is being denied.

-rw-r--r-- 1 logstash logstash 16864089 Feb 19 01:46 logstash_bq_2016-02-19.part020.log

drwxr-xr-x 2 logstash logstash 99 Feb 19 01:46 /opt/logstash-temp

Most of the time this works fine but every now and then this permission denied error pops up followed by the logstash process dying.

The fix for this has been released as part of logstash-output-google_bigquery version 4.0.0. We're no longer using batch uploads so there isn't a bunch of data we're manually rotating on-disk.

WARNING 4.0.0 has breaking changes so read the changelog before upgrading to understand how they'll affect you.

The plugin can be updated with the following command

bin/logstash-plugin update logstash-output-google_bigquery