Cas 3.5.2 audit in database

43 views
Skip to first unread message

mostaf...@zabatak.com

unread,
Aug 23, 2016, 8:41:37 AM8/23/16
to CAS Community
Dears,
i want to make the audit log which user logged in or logout date and time inserted into database 
audit like:-

ACTION: TICKET_GRANTING_TICKET_CREATED
APPLICATION: CAS
WHEN: Tue Aug 23 15:21:15 AST 2016
CLIENT IP ADDRESS: 10.6.129.107
SERVER IP ADDRESS: 10.98.162.225

i want this audit insert in database

i use cas 3.5.2

please what is the configuration ?

Thanks

Alex Olson

unread,
Aug 23, 2016, 9:28:37 AM8/23/16
to mostaf...@zabatak.com, CAS Community
You would need to put something this in your spring configuration somewhere. If you have an auditTrailContext.xml, put it there:

    <bean id="inspektrTransactionManager"
          class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
          p:dataSource-ref="dataSource"
            />

    <bean id="inspektrTransactionTemplate"
          class="org.springframework.transaction.support.TransactionTemplate"
          p:transactionManager-ref="inspektrTransactionManager"
          p:isolationLevelName="ISOLATION_READ_COMMITTED"
          p:propagationBehaviorName="PROPAGATION_REQUIRED"
            />

    <bean id="auditManager" class="com.github.inspektr.audit.support.JdbcAuditTrailManager">
        <constructor-arg index="0" ref="inspektrTransactionTemplate"/>
        <property name="dataSource" ref="dataSource"/>
    </bean>

You'll need to make sure dataSource is defined in your context somewhere and is a valid JDBC datasource.

--
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
To post to this group, send email to cas-...@apereo.org.
Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/e4c5eece-2ad7-4bff-84b8-e3cba182b56e%40apereo.org.
For more options, visit https://groups.google.com/a/apereo.org/d/optout.
--
-- Alex

mostaf...@zabatak.com

unread,
Aug 24, 2016, 2:29:56 AM8/24/16
to CAS Community, mostaf...@zabatak.com
Dear

i put this configueration in audiTrailContext.xml
and i created the dml database and it doesn't work
please help
i attached auditTrailContext.xml

CREATE TABLE "COM_AUDIT_TRAIL" (
  "AUD_USER"      VARCHAR2(100)  NOT NULL ENABLE,
  "AUD_CLIENT_IP" VARCHAR(15)    NOT NULL ENABLE,
  "AUD_SERVER_IP" VARCHAR(15)    NOT NULL ENABLE,
  "AUD_RESOURCE"  VARCHAR2(100)  NOT NULL ENABLE,
  "AUD_ACTION"    VARCHAR2(100)  NOT NULL ENABLE,
  "APPLIC_CD"     VARCHAR2(5)    NOT NULL ENABLE,
  "AUD_DATE"      TIMESTAMP      NOT NULL ENABLE
 );
ALTER TABLE "COM_AUDIT_TRAIL"
  ADD CONSTRAINT "COM_AUDIT_TRAIL_PK"
  PRIMARY KEY (
    "AUD_USER",
    "AUD_CLIENT_IP",
    "AUD_SERVER_IP",
    "AUD_RESOURCE",
    "AUD_ACTION",
    "APPLIC_CD",
    "AUD_DATE"
  ) ENABLE;
 
CREATE TABLE "COM_STATISTICS" (
  "STAT_SERVER_IP" VARCHAR2(15) NOT NULL ENABLE,
  "STAT_DATE" DATE NOT NULL ENABLE,
  "APPLIC_CD" VARCHAR2(5) NOT NULL ENABLE,
  "STAT_PRECISION" VARCHAR2(6) NOT NULL ENABLE,
  "STAT_COUNT" NUMBER NOT NULL ENABLE,
  "STAT_NAME" VARCHAR2(100)
);
ALTER TABLE "COM_STATISTICS"
  ADD CONSTRAINT "COM_STATISTICS_PK"
  PRIMARY KEY (
    "STAT_SERVER_IP",
    "STAT_DATE",
    "APPLIC_CD",
    "STAT_PRECISION",
    "STAT_NAME"
  ) ENABLE;
 
CREATE INDEX "COM_AUDIT_TRAIL_DATE_I"
  ON "COM_AUDIT_TRAIL" ("AUD_DATE");
 
CREATE INDEX "COM_AUDIT_TRAIL_CLIENT_DATE_I"
  ON "COM_AUDIT_TRAIL" ("AUD_CLIENT_IP""AUD_DATE");
 
CREATE INDEX "COM_AUDIT_TRAIL_USER_DATE_I"
  ON "COM_AUDIT_TRAIL" ("AUD_USER""AUD_DATE");
 
CREATE INDEX "COM_AUDIT_TRAIL_ACTION_DATE_I"
  ON "COM_AUDIT_TRAIL" ("AUD_ACTION""AUD_DATE");
 
CREATE INDEX "COM_STATISTICS_DATE_I"
  ON "COM_STATISTICS" ("STAT_DATE");
 
CREATE INDEX "COM_STATISTICS_NAME_DATE_I"
  ON "COM_STATISTICS" ("STAT_NAME""STAT_DATE");
auditTrailContext.xml

mostaf...@zabatak.com

unread,
Aug 24, 2016, 2:31:56 AM8/24/16
to CAS Community, mostaf...@zabatak.com
i attached file contains sql commands 


بتاريخ الثلاثاء، 23 أغسطس، 2016 3:41:37 م UTC+3، كتب mostaf...@zabatak.com:
database-tables.txt
Reply all
Reply to author
Forward
0 new messages