Open thijsvandergugten opened 3 years ago
FWIW I was able to produce a dirty Dockerfile patch which appears to resolve this issue.
RUN cat /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/mimemagic-0.4.3/lib/mimemagic/tables.rb | \
sed 's/common_types = \[/common_types = \["application\/gzip",/g' | \
tee /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/mimemagic-0.4.3/lib/mimemagic/tables.patched.rb \
&& mv /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/mimemagic-0.4.3/lib/mimemagic/tables.patched.rb \
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/mimemagic-0.4.3/lib/mimemagic/tables.rb \
;
Related to https://github.com/mimemagicrb/mimemagic/issues/36, I think it has to do with "priority" of mime magic checking. In the context of the usage in this logstash plugin it's either gzip or it's not, so my patch just puts gzip at the top of the "common types" list. An issue probably should be opened in mimemagicrb/mimemagic regarding this.
Logstash information:
RUN logstash-plugin install logstash-input-google_cloud_storage
in the DockerfileJVM (e.g.
java -version
): OpenJDK 64-Bit Server VM 11.0.8+10OS version: Ubuntu 18.04 LTS
Description of the problem including expected versus actual behavior:
If a file contains the magic string 'dX %', it is not processed, because it is detected as audio/vnd.dts.hd instead of application/gzip. In https://github.com/logstash-plugins/logstash-input-google_cloud_storage/blob/master/lib/logstash/inputs/cloud_storage/file_reader.rb#L26, the snippet
uses code from https://github.com/mimemagicrb/mimemagic/blob/master/lib/mimemagic.rb#L84. As far as I can see, whenever a file contains the magic string 'dX %', it is recognized as audio/vnd.dts.hd which is not equal to a gzip-type.
Steps to reproduce:
Logs: