ilastlog
Version:
alternative lastlog because of Ubuntu 24.04.1. The distros have had the libpam excluding lastlog.so. therefore, I personally needed.
32 lines • 1.83 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("../index");
const sampleTexts = [
"Mon, 10 Feb 2025 15:02:37 +0900 joe-1hostname CRON[17340]: pam_unix(cron:session): session opened for user root(uid=0) by root(uid=0)",
"Mon, 10 Feb 2025 11:02:37 +0900 joe-1hostname CRON[17340]: pam_unix(cron:session): session opened for user root(uid=0) by root(uid=0)",
"Mon, 10 Feb 2025 14:02:37 +0900 joe-1hostname CRON[17340]: pam_unix(cron:session): session opened for user user3(uid=0) by root(uid=0)",
];
const sampleTexts2 = [
"Feb 10 11:02:37 joe-1hostname login[17340]: pam_unix(login:session): session open for user root(uid=0) by root(uid=0)",
"Feb 10 13:02:37 joe-1hostname login[17340]: pam_unix(login:session): session open for user user4(uid=0) by root(uid=0)",
];
const sampleTexts3 = [
"2025-02-01T22:45:32.861235+09:00 joe-1hostname CRON[17340]: pam_unix(cron:session): session opened for user root(uid=0) by root(uid=0)",
"2025-02-25T15:55:01.861235+09:00 joe-1hostname CRON[17340]: pam_unix(cron:session): session opened for user root(uid=0) by root(uid=0)",
];
(0, index_1.setOptions)({ save: true });
console.log("*".repeat(10), "delimiter");
(0, index_1.ilastlog)(sampleTexts, { delimiter: ",," });
console.log("*".repeat(10), "hint + delimiter");
(0, index_1.ilastlog)(sampleTexts, { hint: "cron", delimiter: "~" });
console.log("*".repeat(10), "default hint + default deli");
(0, index_1.ilastlog)(sampleTexts, {});
console.log("Using setOptions()");
(0, index_1.setOptions)({ hint: "cron", delimiter: "" });
console.log("*".repeat(10), "sync");
(0, index_1.ilastlog)(sampleTexts);
console.log("*".repeat(10), "Async");
(0, index_1.ilastlogAsync)(sampleTexts).then(() => {
console.log("callback");
});
//# sourceMappingURL=sample3.js.map