6 Replies Latest reply on Jul 20, 2017 3:23 PM by khanson

    How to monitor AF Server for Element edits?

    khanson

      If I want to monitor for any Element or Element Template Edits globally would I use Notifications or is there some other way to subscribe to monitor for Element/Template changes?  I have seen the video on adding a Notification Template to a Element, but adding this to every element seems cumbersome if I want to just know if anything in the system has changed. 

       

      Thanks in advance,

       

      Ken

        • Re: How to monitor AF Server for Element edits?
          stang

          Hello Ken,

           

          If you want to be able to see changes you can use the Audit Trail.

           

          However if you want to be alerted whenever there is a change, you will have to either use notifications or develop something with AF SDK.

            • Re: How to monitor AF Server for Element edits?
              khanson

              Samuel,

              Thank you for your helpful response, it helped me search the PISquare site for related content. 

               

              However, no good deed goes unpunished , I have a few additional questions.  As you indicated it is my intent to use the AF-SDK to implement this monitoring of Asset Edits.

              1.  Is there any way to be notified when there have been additions to the Audit Trail, or is it necessary to poll for these changes?

              2.  Is there any documentation that details the returned DataTable column definitions for either the AFAuditTrail GetFirst or GetDetails Methods?

              3.  It also appears I can look at modifications using the AFDatabase FindChangedItems method.  Is there any reason this would be less capable/efficient than using the Audit Trail feature?  Can I see changes made by other client applications?

               

              Once again, thanks for your help.

               

              Ken

                • Re: How to monitor AF Server for Element edits?
                  stang

                  Hi Ken,

                   

                  1. You will have to poll. There is no pushing.

                  2. Unfortunately, I cannot find any such documentation.

                  3. A big advantage of the audit trail is that you can easily access it without ever having to touch AF SDK. If you are using AF SDK, FindChangedItems would work just fine. Here is an example of someone's implementation: Track changes happened on AF Database with AF SDK .

                  1 of 1 people found this helpful
                  • Re: How to monitor AF Server for Element edits?
                    kfong

                    Hi Ken,

                     

                    1. The AF Audit Trail uses SQL CDC technology to create records in the SQL table tracking all changes made to the AF Server backend.  You can use the AFAuditTrail class (as you've found) to get at these records.  You would have to write your application to poll for these records; there is no built-in notification/update feature.

                    2. I don't know of any other documentation than what is in the PI AF SDK documentation.  I can get that information for you, though. What details in particular do you want ?

                    3. The PISystem.FindChangedItems call can be used to return all changes made to the system from a certain date.  However, the FindChanges mechanism of the AF Server does not have as much information as AF Audit Trail.  If you have SQL Server Enterprise and AF Audit Trail is an option for you, I would recommend using AF Audit Trail.  You don't even have to write an application to view the records, as PSE provides a GUI. However, if you do not, you can always use the AFSDK FindChangedItems method; just be aware that this might not have all the information that you're looking for.

                     

                    Hopefully that answers your questions.

                    2 of 2 people found this helpful