> 
> Output parameter used to capture whatever your binary prints to
> stdout/stderr.
> 

Well, here is what I did :

$ cat /etc/rsyslog/rsyslog.conf
module(load="omprog")
template(name="mymsg" type="string" string="%msg%")
user.notice    action(type="omprog" output="/tmp/myoutput" 
binary="/usr/bin/yes" template="mymsg")

$ logger test


Here is an excerpt of rsyslog logs :
5821.270315407:main Q:Reg/w0  : processBATCH: next msg 0: <13>Apr  1 20:37:01 
dud225: test
5821.270323795:main Q:Reg/w0  :     PRIFILT 'user.notice'
5821.270329647:main Q:Reg/w0  :     pmask:  X 3F  X  X  X  X  X  X  X  X  X  X  
X  X  X  X  X  X  X  X  X  X  X  X  X  X 
5821.270382603:main Q:Reg/w0  : PRIFILT condition result is 1
5821.270398649:main Q:Reg/w0  :     ACTION 0 [omprog:action(type="omprog" ...)]
5821.270417596:main Q:Reg/w0  : executing action 0
5821.270428295:main Q:Reg/w0  : action 'action 0': called, logging to omprog 
(susp 0/0, direct q 1)
5821.270443844:main Q:Reg/w0  : wti 0xa86520: we need to create a new action 
worker instance for action 0
5821.270456257:main Q:Reg/w0  : wti 0xa86520: created action worker instance 1 
for action 0
5821.270466576:main Q:Reg/w0  : Action 0 transitioned to state: itx
5821.270475332:main Q:Reg/w0  : entering actionCalldoAction(), state: itx, 
actionNbr 0
5821.270505257:main Q:Reg/w0  : omprog: executing program '/usr/bin/yes' with 
'0' parameters
5821.270918732:main Q:Reg/w0  : omprog: child has pid 2638
5821.270930333:main Q:Reg/w0  : omprog: child has outputfile /tmp/myoutput
5821.270963243:main Q:Reg/w0  : * check1 *
5821.270978886:main Q:Reg/w0  : * check1 *
5821.270995931:main Q:Reg/w0  : Action 0 transitioned to state: rdy
5821.271008405:main Q:Reg/w0  : action 'action 0': set suspended state to 0
5821.271011513:main Q:Reg/w0  : END batch execution phase, entering to commit 
phase [processed 1 of 1 messages]
5821.271015667:main Q:Reg/w0  : actionCommitAll: action 0, state 0, nbr to 
commit 0 isTransactional 0
5821.271018644:main Q:Reg/w0  : processBATCH: batch of 1 elements has been 
processed
5821.271022478:main Q:Reg/w0  : regular consumer finished, iret=0, szlog 0 sz 
phys 1
5821.271043497:main Q:Reg/w0  : DeleteProcessedBatch: we deleted 1 objects and 
enqueued 0 objects
5821.271047491:main Q:Reg/w0  : doDeleteBatch: delete batch from store, new 
sizes: log 0, phys 0
5821.271051350:main Q:Reg/w0  : regular consumer finished, iret=4, szlog 0 sz 
phys 0
5821.271054803:main Q:Reg/w0  : main Q:Reg/w0: worker IDLE, waiting for work.
5821.277575763:main thread    : rsyslogd: child 2638 has terminated
5821.277596236:main thread    : rsyslogd: child -1 has terminated
5821.277603119:main thread    : janitorRun() called


Unfortunately there is no /tmp/myoutput file.

> >Also I noticed that whenever binary writes to some file during its
>> execution, nothing is written till rsyslog is stopped. Is this behaviour
>> intended ?
> If you write small amounts of data, it will be in the buffer for some time.
> Use fsync if you want to make sure your writes are persisted.
> 

I tried with this program : 
http://kb.monitorware.com/omprog-config-usage-t12301.html#p24467  which 
autoflushes the output, unfortunately it doesn't force the creation of the file 
either.


Regards,

dud225
                                          
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to