Article
· Apr 11 2m read

How to view the contents of journal files outside of the Management Portal

InterSystems FAQ rubric

If the journal file is too large to be searched or filtered using the Management Portal, you can refer to it using the following two methods.

① How to use the ^JRNDUMP utility
② How to reference it in a program

================================================== ========== 

① Using the ^JRNDUMP utility. For example, if you want to select all records in the journal file that include the global reference ^ABC, do the following:

*Please execute all commands below in the %SYS namespace.

DO SELECT^JRNDUMP("C:\MyCache\mgr\journal\YYYYMMDD.001","","","^ABC",1)

If you want to select only records that exactly match the global reference ^ABC: 

 DO SELECT^JRNDUMP("C:\MyCache\mgr\journal\YYYYMMDD.001","","","^ABC",0)

If you want to select only records for local Set operations on global ^ABC, do the following: 

 DO SELECT^JRNDUMP("C:\MyCache\mgr\journal\YYYYMMDD.001","","","^ABC","",6)

If you want to select only records for local and remote Set operations on the global ^ABC: 

  DO SELECT^JRNDUMP("C:\MyCache\mgr\journal\YYYYMMDD.001","","","^ABC","","s")

Please see the document page below for details.

Displaying journal records using ^JRNDUMP

================================================== ========== 
② How to reference it in a program. You can use the %SYS.Journal.Record class to obtain the record contents of any journal file.

 set jrn="C:\intersystems\cache\mgr\journal\20160101.003"
  set log="C:\temp\journal.log"

  set file=##class(%File).%New(log)
  do file.Open("WSN")
  set rs=##class(%ResultSet).%New("%SYS.Journal.Record:List")
  do rs.Execute(jrn)
  while rs.Next() {
    set time=rs.Get("TimeStamp") // Time: yyyy-mm-dd hh:mm:ss
    set type=rs.Get("TypeName")  // Type: SET, KILL, xxTrans etc.
    set gref=rs.Get("GlobalReference") // global reference
    set gval=rs.Get("NewValue")  // Updated value
    /* if gref["ABC" { */
    set line=time_" ["_type_"] "_gref
    if type="SET" { set line=line_"="_gval }
    do file.WriteLine(line)
    /* } */
  }
  do file.Close()

Please see the class reference below for details.

Class reference (%SYS.Journal.Record:List)

Discussion (0)1
Log in or sign up to continue