English 中文(简体)
perl file:Tail syncronization
原标题:perl File::Tail syncronization

im having this situation: Im parsing some log files with perl daemon. This daemon writes data to mysql db.

后勤档案可以:

  1. be rotated ( solved by filesize and some logic )
  2. doesnt exist ( ignore_nonexistant parameter in Tail)

Daemon:

  1. Can be killed
  2. Can became dead by some reazon.

Im using file:Tail to tail tha file. 建立日期或档案的轮换机制可以有所帮助。 什么机制应该用来从档案中的某些位置开始尾声? (大概如此之多,无法书面查阅档案系统)。

我想到的是非行的立场变异,但这赢得了我的帮助。

也许有些机制会把位置参数传递给教区进程?

我只是想重新发明自行车。

问题回答

文件:Tail已经发现轮换,并继续从新档案中阅读。

为了处理 da魔dy死和重新启用的问题,你能否询问该数据库,以备在 da子重新启用时所写的最后记录,在你到达后一行之前,仅贴上微薄的标识线?

Try http://search.cpan.org/dist/Log-Unrotate/. You ll have to implement your own Log::Unrotate::Cursor class if you wish to store position files in DB instead of local filesystem, but that should be trivial.

我们撰写并使用了<代码>行文记录仪:在制作5年时没有旋转,而且实际上很难从不提取任何数据。 (如果贵方的 cur子变得无效,例如,如果 log子多次轮换,而读物者出于某种原因不工作,则试图如此努力地放弃例外。) 您不妨允许<代码>autofix_cursor选择改变这一行为。

另见。 我从未使用过它,而是应该解决同样的任务。





相关问题
Why does my chdir to a filehandle not work in Perl?

When I try a "chdir" with a filehandle as argument, "chdir" returns 0 and a pwd returns still the same directory. Should that be so? I tried this, because in the documentation to chdir I found: "...

How do I use GetOptions to get the default argument?

I ve read the doc for GetOptions but I can t seem to find what I need... (maybe I am blind) What I want to do is to parse command line like this myperlscript.pl -mode [sth] [inputfile] I can use ...

Object-Oriented Perl constructor syntax and named parameters

I m a little confused about what is going on in Perl constructors. I found these two examples perldoc perlbot. package Foo; #In Perl, the constructor is just a subroutine called new. sub new { #I ...

Where can I find object-oriented Perl tutorials? [closed]

A Google search yields a number of results - but which ones are the best? The Perl site appears to contain two - perlboot and perltoot. I m reading these now, but what else is out there? Note: I ve ...

热门标签