1

Since file input is buggy for logstash on Solaris, I am trying to use the pipe input instead. A configuration based on a "tail -f" works great, but the problem is that the file is being rolled over every time it reaches 20MB, which happens about once a week.

So I googled for a way of tailing tolerating rollover and found that tail -F would be the solution... if that command was available on Solaris 10. I also found a shell script that could do the trick, but the permanent cpu consumption of 1.5% is quite dissuasive.

So I am looking for alternatives. Ideally I would rather not have to install third-party software which requires administration privileges I don't own, or which requires recompilation since there is a very low probability for it to work (there is always some lib version requirement which fails).

I am considering using an enhanced perl script like we can find some when googling on the topic or even make a java interface (but not sure it would cost less resources than the shell script), but before that I was wondering if there was a simpler way around.

How did you do before the -F flag was introduced?

Community
  • 1
  • 1
Aldian
  • 2,592
  • 2
  • 27
  • 39
  • install the GNU coreutils and use tail from there; there appears to even be a package: http://www.opencsw.org/package/coreutils/ – ysth Mar 21 '14 at 17:44
  • In case you would not know, you have to pay a subscription to access opencsw packages. But even if I did, I don't own admin rights on the system, so... – Aldian Mar 21 '14 at 17:51
  • the GNU flavors of several tools are so useful, they often get installed; are you sure they are not already there (in a non-standard path)? if not, maybe you can get your admin to install them. see http://unix.stackexchange.com/questions/66415/solaris-default-install-user-tools for a free source for Solaris 10 – ysth Mar 21 '14 at 22:00

1 Answers1

2

You should take a look at Perl Power Tools, a project to "reimplement the classic Unix command set in pure Perl". tail is one of the commands that the project implements.

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Borodin
  • 126,100
  • 9
  • 70
  • 144
  • Wow this is working right and smooth and the cpu consumption is around 0.03%, which is far far better than the shell script. I knew about busybox, but not about those perl scripts. You made my day and this will probably help me in a lot of other situations! I will let this open for two or three days, then come back and probably accept your answer :) – Aldian Mar 21 '14 at 17:44
  • It'a also a nice way to get Unix commands on a foreign (Windows) platform, and very easy to tweak the commands with your own options. Glad I could help. – Borodin Mar 21 '14 at 17:52
  • @Borodin Do you know of a convenient way to install `ppt` on a windows system? Is there a `cpan` method like the way `Mojolicious` automatically sets up `morbo`, `hypnotoad`, and `mojo`? – Miller Mar 24 '14 at 05:36
  • @Miller: I'm sorry I overlooked your question. You can install Perl Power Tools by using CPAN to install `PPT::Util`. No such module will actually be installed. Instead you will find shell scripts in (I think) `/usr/local/ppt/bin`. – Borodin Mar 26 '14 at 00:21
  • @Borodin Thanks, installed. Noticed a small bug with `awk` when run w/o parameters. `Use of uninitialized value $tmpin in unlink at C:\usr\local\ppt\bin\awk line 15.` Care to teach me how to report those warnings? Doubt things would be updated, but I'd be nice to know how to do that. – Miller Mar 26 '14 at 02:40
  • @Borodin `awk` could be fixed by changing line line 15 to: `unlink for grep defined $tmpin, $tmpout; # XXX: don't check failure` – Miller Mar 26 '14 at 02:43
  • @Borodin Figured it out. emailed bug-ppt. – Miller Mar 26 '14 at 04:34