Kbase P127541: Auditing: How to invoke the ABL LOG-AUDIT-EVENT() method?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  12/11/2007 |
|
Status: Unverified
GOAL:
Auditing: How to invoke the ABL LOG-AUDIT-EVENT() method?
GOAL:
How to log the client's IP address using the ABL LOG-AUDIT-EVENT() method?
GOAL:
How to get the IP Address of the ABL client machine using OS-COMMAND statement?
GOAL:
How to get the IP Address of a Windows ABL client machine using OS-COMMAND statement?
GOAL:
How to get the IP Address of a UNIX ABL client machine using OS-COMMAND statement?
FACT(s) (Environment):
All Supported Operating Systems
OpenEdge 10.1x
FIX:
The following code sample shows how to invoke the LOG-AUDIT-EVENT() method of the AUDIT-CONTROL system handle. The LOG-AUDIT-EVENT( ) method creates an audit record for the specified application-defined audit event in each connected audit-enabled database whose current audit policy has this audit event enabled. The code also shows how to use the OS-COMMAND statement to get the IP Address of the client machine:
DEFINE VARIABLE cIPAddress AS CHARACTER NO-UNDO.
DEFINE VARIABLE lNextLine AS integer NO-UNDO.
RUN getIPAddress(OUTPUT cIPAddress).
AUDIT-CONTROL:LOG-AUDIT-EVENT( 32000,
"This is the event context " + cIPAddress,
"This is the event detail " + cIPAddress,
"This is the user detail " + cIPAddress
).
PROCEDURE getIPAddress.
DEFINE OUTPUT PARAMETER opcIPAddress AS CHARACTER NO-UNDO.
DEFINE VARIABLE cCommandLine AS CHARACTER NO-UNDO.
DEFINE VARIABLE cLine AS CHARACTER NO-UNDO.
IF OPSYS = "UNIX" THEN DO:
cCommandLine = "/usr/sbin/ifconfig -a > temp.txt".
OS-COMMAND SILENT VALUE(cCommandLine).
INPUT FROM temp.txt.
REPEAT:
IMPORT UNFORMATTED cline.
IF index(cline, "BROADCAST" ) > 0 THEN lNextLine = lNextLine + 1.
IF lNextLine = 2 THEN DO:
ASSIGN
opcIPAddress = TRIM(ENTRY(2, cLine, " ")).
LEAVE.
END.
END.
INPUT CLOSE.
END.
ELSE IF OPSYS = "WIN32" THEN DO:
cCommandLine = "ipconfig /all > temp.txt".
OS-COMMAND SILENT VALUE(cCommandLine).
INPUT FROM VALUE ("temp.txt").
REPEAT:
IMPORT UNFORMATTED cline.
IF INDEX(cLine, "IP Address") > 0 THEN
ASSIGN
opcIPAddress = TRIM(.ENTRY(2,cline,":")).
END.
INPUT CLOSE.
END.
END PROCEDURE..