Author Topic: Connector LastModified using Audit Log  (Read 13672 times)

Adam P

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Connector LastModified using Audit Log
« on: January 20, 2015, 10:22:58 am »
I am trying to get a "LastModified" time for connectors in my model. I have turned on Auditing and can see the modification dates in the Audit Log, but I would like to output that data programmatically.

How do I go about getting Audit data out of the repository and / or database? I see a mention in Thomas's book about the t_snapshot table -- is the best route to do a SQLQuery() to find the GUID and modification dates in that table?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Connector LastModified using Audit Log
« Reply #1 on: January 20, 2015, 10:41:05 am »
The API only supports Clear and Save for the audit. So SQLQuery is the way to go here.

q.
« Last Edit: January 20, 2015, 10:41:24 am by qwerty »

Adam P

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Connector LastModified using Audit Log
« Reply #2 on: January 20, 2015, 10:59:25 am »
Thanks. Is the t_snapshot table the right table to query for audits logs? I don't see any timestamp in that table, unless it is hidden in the binary blobs.

Here's an example of the XML I am getting back from t_snapshot:
http://codebin.org/view/b5ebdbf2

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Connector LastModified using Audit Log
« Reply #3 on: January 20, 2015, 09:12:30 pm »
Good grief :( My brain doesn't seem to be what it used to be. Actually there is no time stamp inside. I'd have made an oath that there is :-[

Now, there's always a way around. Once you found the modification entry for a connector just find the previous and next one for a normal element which have not been changed successively and inspect their modification date. A rather awkward deviation.  ::)

Can you tell us the intention for finding the modification date of connectors?

q.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Connector LastModified using Audit Log
« Reply #4 on: January 20, 2015, 09:23:10 pm »
Back to business :)

The record actually contains the time stamp:
Quote
User="Adam" DateTime="2015-01-19 10:13:51"
Just decode Bincontent1 using base64 (you can do that with Notepad++) and unzip the result. Inside is a str.dat file which contains the information in XML format.

q.
« Last Edit: January 20, 2015, 09:24:45 pm by qwerty »

Adam P

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Connector LastModified using Audit Log
« Reply #5 on: January 21, 2015, 01:32:18 am »
Wow, I certainly would have never found that. Thanks a million.

The reason behind all this is that I have created a rather complex data mapping model which is providing field-level mapping from multiple source databases, through an enterprise services bus (ESB), to a central database. This creates thousands of attribute-to-attribute connectors that need to be communicated with various parts of the team (e.g. - the engineers that are implementing the ESB code, data modelers, etc.) which is currently being done through a script that creates a CSV of all the data mappings.

The team needs a "last modified" timestamp to see what has been updated since the last version of the data mapping document.

As a follow-on question: I'm implementing this as a JScript under EA so that it is more maintainable and easier for people after me to run it without installing an external development environment. I'm now going to need to load an unzip library to get at the contents of BinContent1. Is there any way to load a JavaScript library such as zip.js from within a EA JScript? e.g. - http://gildas-lormeau.github.io/zip.js/fs-api.html

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13287
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Connector LastModified using Audit Log
« Reply #6 on: January 21, 2015, 02:01:02 am »
If they are just javascript then you can copy them into jscript scripts and use !INC to include them.

Geert

Adam P

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Connector LastModified using Audit Log
« Reply #7 on: January 21, 2015, 02:56:35 am »
Unzipping binContent to get at the XML content is turning out to be a total nightmare. Anyone have any tricks or tips about how to do this from JScript?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Connector LastModified using Audit Log
« Reply #8 on: January 21, 2015, 05:50:55 am »
You'd better be served on StackOverflow with that kind of question. I guess there is some lib for base64 decode as well as unzip.

q.

P.S.: http://techslides.com/extract-zip-and-rar-files-with-html5
« Last Edit: January 21, 2015, 05:54:55 am by qwerty »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Connector LastModified using Audit Log
« Reply #9 on: January 21, 2015, 05:53:18 am »
Quote
The team needs a "last modified" timestamp to see what has been updated since the last version of the data mapping document.
How about teaching them to read the audit log from within EA?

q.

Adam P

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Connector LastModified using Audit Log
« Reply #10 on: January 27, 2015, 02:15:24 am »
Quote
Back to business :)

The record actually contains the time stamp:
Quote
User="Adam" DateTime="2015-01-19 10:13:51"
Just decode Bincontent1 using base64 (you can do that with Notepad++) and unzip the result. Inside is a str.dat file which contains the information in XML format.

q.

I got the code working last night to base64 decode, unzip and inflate the BinContent section. Thanks again for the help -- is there someplace I can share this code for the benefit of others?

q: As I'm looking at the Notes section of the audits, it's not entirely clear what all the different fields are supposed to mean in different circumstances. Do you have any thoughts / documentation about the Audit Notes field?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Connector LastModified using Audit Log
« Reply #11 on: January 27, 2015, 05:16:44 am »
Regarding sharing: have a look at http://community.sparxsystems.com. That's probably a good place.

Regarding the notes: I don't have a general insight. If you have a specific field feel free to ask. We all will see what it could be.

q.

Michel Gibelli

  • EA Novice
  • *
  • Posts: 14
  • Karma: +1/-0
    • View Profile
Re: Connector LastModified using Audit Log
« Reply #12 on: March 31, 2015, 10:34:41 pm »
Quote

I got the code working last night to base64 decode, unzip and inflate the BinContent section. Thanks again for the help -- is there someplace I can share this code for the benefit of others?
 

Hello Adam
Have you shared this code somewhere ?
I am very interested

Thanks
Michel

Ian Mitchell

  • EA User
  • **
  • Posts: 506
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: Connector LastModified using Audit Log
« Reply #13 on: August 30, 2017, 05:56:16 pm »
@Adam P - did you ever post the code to do the decoding somewhere?
I really need to access this Audit data (and all the other base64 stuff which is in the data model thee days), and whilst I understand the principle form bits of other posts, nobody has - so far-  posted a complete solution:
- get column from EA (in base64)
- return some content (probably XML) which can be processed.
I somehow get lost in the byte array, memorystreams and encoding.
Sounds like you have a solution.
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

mhuebsch

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Connector LastModified using Audit Log
« Reply #14 on: September 21, 2017, 11:28:05 pm »
I am interested too. I'd like to be able to identify who is making the change, when they made it, and what elements or connectors they changed.