Search code examples
clinuxloadrunnersyslogrsyslog

How to run a linux command from loadrunner vugen script?


I am using Linux LGs and I want to use syslog / rsyslog to dump the custom logs from my loadrunner vugen script. For that I tried to run a linux command by using the loadrunner function int system( const char *string); but it's not working for me. Do you have any alternative for this?

For your ready reference please check the custom function which I have used for using the syslog / rsyslog.

lr_syslog(char *log)
{

lr_param_sprintf("PAR_syslog", lr_eval_string("./syslog %s"), log );

system(lr_eval_string("{PAR_syslog}")); 

return 0;
}

and syslog.c is as follows

#include <syslog.h>
void main(int argc, char *argv[])
{
openlog ("loadrunner", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
syslog (LOG_INFO, "customlog - %s", argv[1] );
closelog ();
}

Thanks in advance.


Solution

  • May I suggest as an alternative the use or lr_output_message() which will be directed to the output window on your controller.

    If you wish to post process these messages in logparser, elk, or splunk you can then export the messages and import them into your favored log analysis tool..... or you can just use the features of Microsoft Access to run queries against the messages using standard SQL.