Retrieve Login Info Without Server Access
Sometimes you might be tasked with finding when a particular operator logged into the Adobe Campaign Classic rich client, even if you do not have access to the actual application server.
Here is a simple JavaScript snippet that allows you to explore the ‘logins.log’ file and more. I wanted to know whether a particular user has logged into the server in the past. I can see that ‘logins.log’ only retains a year’s worth of data.
///neolane/nl6/var/your_application_instance_name var file = new File("logins.log") file.open(); var pattern = "opertor.name"; // Create a RegExp object using the pattern var regex = new RegExp(pattern, "gi"); // 'gi' for case-insensitive and global matching for each(var line in file) if(regex.test(line)) logInfo(line) file.close()
- File Initialization:
new File("logins.log")
. You can take a look at the example code on the JSAPI documentation - Open file:
file.open()
This method opens the file for reading. It is necessary to open a file before you can read from or write to it. - Regular expression setup: Here, a regular expression pattern is defined to search within the file. The
RegExp
object is initialized with this pattern and the"gi"
flag for global case-insensitive search. - File processing: This loop iterates through each line of the file. For each line, it checks if the line matches the regular expression. If it matches, it logs the line using
logInfo(line)
to the workflow’s journal. - Close file: file.close() After all lines are processed, the file is closed to free up system resources.