@@ -67,7 +67,7 @@ string gRecordFile;
6767
6868void usage ()
6969{
70- cout << " usage: orchagent [-h] [-r record_type] [-d record_location] [-b batch_size] [-m MAC] [-i INST_ID] [-s] [-z mode] [-k bulk_size]" << endl;
70+ cout << " usage: orchagent [-h] [-r record_type] [-d record_location] [-f swss_rec_filename] [-j sairedis_rec_filename] [- b batch_size] [-m MAC] [-i INST_ID] [-s] [-z mode] [-k bulk_size]" << endl;
7171 cout << " -h: display this message" << endl;
7272 cout << " -r record_type: record orchagent logs with type (default 3)" << endl;
7373 cout << " 0: do not record logs" << endl;
@@ -81,6 +81,8 @@ void usage()
8181 cout << " -s: enable synchronous mode (deprecated, use -z)" << endl;
8282 cout << " -z: redis communication mode (redis_async|redis_sync|zmq_sync), default: redis_async" << endl;
8383 cout << " -k max bulk size in bulk mode (default 1000)" ;
84+ cout << " -f swss_rec_filename: swss record log filename(default 'swss.rec')" << endl;
85+ cout << " -j sairedis_rec_filename: sairedis record log filename(default sairedis.rec)" << endl;
8486}
8587
8688void sighup_handler (int signo)
@@ -164,8 +166,10 @@ int main(int argc, char **argv)
164166 sai_status_t status;
165167
166168 string record_location = " ." ;
169+ string swss_rec_filename = " swss.rec" ;
170+ string sairedis_rec_filename = " sairedis.rec" ;
167171
168- while ((opt = getopt (argc, argv, " b:m:r:d:i:hsz:k:" )) != -1 )
172+ while ((opt = getopt (argc, argv, " b:m:r:f:j: d:i:hsz:k:" )) != -1 )
169173 {
170174 switch (opt)
171175 {
@@ -244,6 +248,18 @@ int main(int argc, char **argv)
244248 }
245249 }
246250 break ;
251+ case ' f' :
252+ if (optarg)
253+ {
254+ swss_rec_filename = optarg;
255+ }
256+ break ;
257+ case ' j' :
258+ if (optarg)
259+ {
260+ sairedis_rec_filename = optarg;
261+ }
262+ break ;
247263 default : /* '?' */
248264 exit (EXIT_FAILURE);
249265 }
@@ -252,7 +268,7 @@ int main(int argc, char **argv)
252268 SWSS_LOG_NOTICE (" --- Starting Orchestration Agent ---" );
253269
254270 initSaiApi ();
255- initSaiRedis (record_location);
271+ initSaiRedis (record_location, sairedis_rec_filename );
256272
257273 sai_attribute_t attr;
258274 vector<sai_attribute_t > attrs;
@@ -267,7 +283,7 @@ int main(int argc, char **argv)
267283 /* Disable/enable SwSS recording */
268284 if (gSwssRecord )
269285 {
270- gRecordFile = record_location + " /" + " swss.rec " ;
286+ gRecordFile = record_location + " /" + swss_rec_filename ;
271287 gRecordOfs .open (gRecordFile , std::ofstream::out | std::ofstream::app);
272288 if (!gRecordOfs .is_open ())
273289 {
0 commit comments