简体   繁体   English

日志处理-将日志文件中的每一行作为参数实时发送到脚本中

[英]Log processing - send each new line in a log file as a parameter to script in real time

I have an active log file (which means there are new lines of log information appended to the file in real time). 我有一个活动的日志文件(这意味着实时会有新行的日志信息附加到该文件中)。

What I want: When there is a new line appended, pass the new line of log as a parameter to a script (Bash, C, or even PHP). 我想要的是:当添加新行时,将新的日志行作为参数传递给脚本(Bash,C甚至PHP)。

What is better: instead of open a new process for every new line of log appended, run a demon process in the background to accept each line of new input. 更好的方法是:与其在每个新添加的日志行中打开一个新进程,不如在后台运行一个妖魔进程以接受新输入的每一行。

I tried to Google, but haven't found any useful keyword to start. 我尝试使用Google,但没有找到任何有用的关键字来启动。

By the way, it's running on Debian. 顺便说一下,它正在Debian上运行。

而不是为每个附加的新日志行打开一个新进程,而是在后台运行一个恶魔进程以接受新输入的每一行。

tail -f log | demon&

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM