Written by

Developer at HBT
Question Niklas Thilmont · Mar 14, 2022

Executing Actions on Global Interaction / Global Hooks?

Hey InterSystems Community!
This is probably far-fetched - is there a way to get notified/get a piece of code triggered whenever the state of a global changes?

Now what could I possibly want with that? Quite simple! I would like to forward the content of a global (in this case the "FSLog" global written by the FHIR implementation) while adding timestamps to it - to create some sort of file-based logging for it.

Product version: IRIS 2021.1

Comments

Robert Cemper · Mar 14, 2022

If your global is part of a class/table class parameter DSTIME could be an approach.
or any SQL trigger or any %OnAfterSave,  %OnAfterDelete, ...
 
For pure Globals all you have is the Journal (if enabled) 

0
Niklas Thilmont  Mar 15, 2022 to Robert Cemper

Sadly it's a pure global in this case. But I will keep that in mind for the future, as logging to globals seems to be a common thing, and some actually are backed by classes.

0
Michael Poxon · Mar 14, 2022

Following on Robert's idea of the journal, you might set up a shadow server with a custom filter routine.  That routine could examine each journaled global set/kill that comes to it, choose the ones it cares about and do something with them, then "quit 0" so the shadow doesn't actually dejournal the activity.

0
Niklas Thilmont  Mar 15, 2022 to Michael Poxon

We were thinking of using filebeat anyway. This might actually work smooth enough, with filebeat on the journal, filtering in a later step? I'll have to take a closer look at the journal itself, thank you!

0
Marc Mundt · Mar 14, 2022

How about polling the global looking for updates? It would be lightweight to just check if the value of ^FSLOG has incremented since the last check:

set lastFSEntry = ^FSLOG

or use $order:

set lastFSEntry = $order(^FSLOG(""),-1)

As for timestamps, in my test environment all of the ^FSLOG entries seem to end with timestamps already:

^FSLOG(41)="DispatchRequest^HS.FHIRServer.Service^11062|Msg|  [1] -> DO  0|03/14/2022 01:57:19.398158PM"
0
Niklas Thilmont  Mar 15, 2022 to Marc Mundt

Mine doesn't do that - yet. Still using HealthShare 2020.1. I assume it'll be added with a later version!

11:     ^FSLOG(10)    =    "DispatchRequest^HS.FHIRServer.Service^3245|Msg|Dispatch interaction search-type for MedicationAdministration"
12:     ^FSLOG(11)    =    "BuildIncludeList^HS.FHIRServer.Service^3245|_include|include: "
13:     ^FSLOG(12)    =    "BuildRevIncludeList^HS.FHIRServer.Service^3245|_include|revInclude: "

As for the polling - I guess with a timestamp maybe added in the future (We're planning to upgrade soon), this may very well be the smartest solution. Thanks!

0
Marc Kleser  Mar 15, 2022 to Rob Tweed

Discover top-notch fencing solutions at the expert Zaun7.de in Germany, where you can find high-quality fences, garden fences, and double-rod mesh fences. With a commitment to excellence, Zaun7.de offers durable and aesthetically pleasing options for securing your outdoor space.

For exceptional garden furniture and lounge sets, look no further than the experts at Gartenmoebel7.de. Elevate your outdoor living experience with a wide range of stylish and comfortable garden furniture options. At Gartenmoebel7.de, you'll find premium products designed to enhance the beauty and functionality of your garden or patio. Explore their collection for the perfect blend of quality and style.

Thank you for the helpful link.

0
Herman Slagman · Mar 14, 2022

The only way you could accomplish this is by watching the journal files, there would be journals like "Set Global" and "Kill Global"

0