Dear members,
Hope everyone is doing great.
Can someone help me How we can creat a schedule job to compress and archive webMethods log files automatically.
Its urgent , pls help me.
regards,
Hari
Dear members,
Hope everyone is doing great.
Can someone help me How we can creat a schedule job to compress and archive webMethods log files automatically.
Its urgent , pls help me.
regards,
Hari
Archive of webMethods log files inside IS/logs folder will happen by default. You would have seen the older files appended with date. For compression of the same, you have to write some custom service and schedule it to run everyday once.
-Senthil
Hi Senthil,
Thanks for your reply, Since I dont much experience in webMethods, Could you pls help me the procedure(steps) how we can write the code.
regards,
Hari
You can write a java service to do the same… Here is a sample…
// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
String fileName = IDataUtil.getString( pipelineCursor, “fileName” );
String fileDir = IDataUtil.getString( pipelineCursor, “fileDir” );
String inputString = IDataUtil.getString( pipelineCursor, “inputString” );
String zipFileName = IDataUtil.getString( pipelineCursor, “zipFileName” );
String zipFileDir = IDataUtil.getString( pipelineCursor, “zipFileDir” );
pipelineCursor.destroy();
// pipeline
zipFileName = zipFileDir+zipFileName;
byte buf = new byte[1024];
try {
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFileName));
// Compress the files
FileInputStream in = new FileInputStream(fileDir+fileName);
out.putNextEntry(new ZipEntry(fileName));
// Transfer bytes from the file to the ZIP file
out.write(inputString.getBytes());
// Complete the entry
out.closeEntry();
in.close();
// Complete the ZIP file
out.close();
} catch (IOException e) {
}
HTH
Senthil
Thanks a lot…