1

I am currently trying to have Logstash work on Solaris with the File Input method. But I am encountering some bugs (see LOGSTASH-665). After digging a lot, it appears that native support for File.stat on my system (SunOS 5.10, JDK 1.6.0_21, 32 bit) is totally deficient, so I am looking for a way to properly handle it.

Specifically I want to access the inode information. Based on the metadata I can gather about the file (like its path and whatever is available on solaris), I want to calculate a number which is unique for that file, and which changes when the file is replaced by another file which has the same name. At first I thought about simply using a hash of the file path and used this function as a replacement, but indeed, when the file is rolled over the number does not change, so I need to also access the ctime information...

..Or make a system call to get the ls -li result to get the real inode number by another way.

Problem is that I never used ruby before, I am more used to java, so I am struggling to find a solution. Every suggestion will be appreciated.

Community
  • 1
  • 1
Aldian
  • 2,592
  • 2
  • 27
  • 39

1 Answers1

0

The best solution I know of is to wrap the native call using JNI or JNA.

There do appear to be a couple of projects that have done this, although I haven't used either of them. See this question: Is there a Java library of Unix functions?

Community
  • 1
  • 1
Daniel Pryden
  • 59,486
  • 16
  • 97
  • 135
  • I am not going to accept this answer because it is just hints, nothing like an easy solution, and also because Jruby already uses JNA, so this is JNA which fails. JNI may have a chance to work though... Anyway thanks for your answer, I will keep searching ;) – Aldian May 19 '14 at 12:53