Is there a way to view/mount journals from another system on a local instance ?
I have several 1GB journals from a LIVE server that I would like to inspect (eg: check which globals have been updated over the time).
Is there a simple way to view those journals using another IRIS instance ? (eg: local installation).
I have been tempted to put those files directly into the journal folder of my local installation and restart the system, however I am concerned that the transactions they contains will be restored and will corrupt the local database.
I have checked documentation but couldn't find anything.
Comments
Well, from my experience you will need the same databases on your local instance, so you will need to load a backup from the original into the local instance and after that apply the journal file generated after the creation of this backup from the original.
You can read journal files from any instance, but using Journals API, not using management portal
You are probably talking about this :
https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic…
I didn't know it existed. I will take a look.
EDIT: busted by Chad
You should definitely avoid putting strange journal files in your local journal directory!
As Dmitry suggested, the Journal APIs will let you read the contents of a journal file. You can also use the existing Journal Profile utility for a general sense of which globals are most active in the file.
set path = ##class(%SYS.Journal.System).GetLastFileName() //example, use any journal file do ##class(%CSP.UI.System.OpenJournalPane).ComputeJournalProfile(path) zw:$ZV["Cach" ^CacheTemp.JournalProfile(path) zw:$ZV["IRIS" ^IRIS.Temp.JournalProfile(path)
Thanks a lot. I will try that ASAP.
Here is what I end up using :
set file = ##class(%File).%New("journal.txt")
set sc = file.Open("NW")
set path = ##class(%SYS.Journal.System).GetLastFileName()
set journal = ##class(%SYS.Journal.File).%OpenId(path)
set rec = journal.FirstRecord
while$iso(rec)
{
if (rec.TypeName = "SET") || (rec.TypeName = "KILL")
{
do file.WriteLine(rec.Address_$c(9)_rec.TimeStamp_$c(9)_rec.ProcessID_$c(9)_rec.TypeName_$c(9)_rec.InTransaction_$c(9)_rec.GlobalNode_$c(9)_rec.DatabaseName)
}
set rec = rec.Next
}
set journal = ""do file.Close()Great solution!
I compared the performance against querying %SYS.Journal.Records:List and found that using the objects is >10 times faster. Oddly, I couldn't execute the query via %SQL.Statement.
TestJournalFileNext 0.777671s
TestJournalResultSet: 10.972615s
FYI:
You also use List query in %SYS.Journal.Record.
set rs=##class(%ResultSet).%New("%SYS.Journal.Record:List")
set jrn=##class(%SYS.Journal.System).GetLastFileName() // or input file pull pathdo rs.Execute(jrn)
write rs.Next()
write rs.Get("Address"),"-",rs.Get("TimeStamp"),"-",rs.Get("ProcessID"),"-",rs.Get("TypeName"),"-",rs.Get("InTransaction"),"-",rs.Get("GlobalNode"),"-",rs.Get("DatabaseName"),!
do rs.Close()Note: it doesn't work with %SQL.Statement
Although in Japanese, this article is related to it : https://jp.community.intersystems.com/node/492721
Also you should be able to open any journal file from the Management Portal View Journal -- replace path to a journal file in the URL and you should see its contents
Although the interface is clunky for looking through large journal files, the startup cost is negligible:
%SYS>DO ^JRNDUMP
Select "G" for Goto
File: enter your filename which doesn't have to be and shouldn't be in the main journal directory.
At this point the interface is limited, but "F" for Find might help.