Hi,
I have a perl script to read the log file and create a report from it. I have the script file and log file in a different directories. Now i have pipe the log file data to the perl script to create the report (HMTL file). I am using the below command this isn't working
tail -f /$LOG_DIR/app.log | perl $SCRIPT_DIR/run_report.pl
But if i use cat command it works,
cat /$LOG_DIR/app.log | perl $SCRIPT_DIR/run_report.pl
Please advice to use tail or any other commands to create the report dynamically instead of cat.
i could be missing something but ...
the tail -f | perl command will not work until the perl script is done getting its data and the stream closes ... the cat | perl command results in a closed data stream so it does not have the same issue ...
unless your perl script is able to generate the formatted report and update the same report immediately as new data streams in, i think you would be better off running a check on the log file or periodically just tailing a portion of it and then run it through your perl script ...
Ice,
Do we have any other options to get the stream data to feed the perl script?
there is nothing wrong with the data feed ... your issue is that your perl script cannot handle the continuous data stream ...
you might want to revisit your script and/or your requirements ...
if you really want continuous data formatting with tail -f | perl , please read up some more on advance perl programming as well as research all available perl modules ... have fun reading!
Thanks for the info Ice. I do not have more time to complete this with advanced scripting and i can't revisit my requirements at this stage. Let me proceed with 'cat' for now at least.