I'm trying to read the output of the last
command in Nxlog. I would like to run last
on the utmp
file on regular intervals. In other words I want to schedule a shell command to run with a time interval and pipe the output as a log event. In yet other words I would like to have <Schedule>
clauses in a im_exec
module but it seems that this is not possible so I'm trying something else (the example is for linux):
<Input sample_umtp_linux>
Module im_null
<Schedule>
Every 1 sec
Exec exec("/usr/bin/last", "-f", "/var/run/utmp");
</Schedule>
</Input>
<Output out_debug>
Module om_file
File '<mydir>/debug.log'
</Output>
<Route processwtmp>
Path sample_umtp_linux => out_debug
</Route>
I don't get any error messages, but I don't get any output either. Is there some way to catch the output and feed it into the Nxlog routing?
(Additional limitation: I'm going to deploy the solution to Hp Ux, so my options are a bit limited in terms of available system tools. I'd like to depend as little as possible on things outside Nxlog itself.)