<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
%=================================================================
\section{The alogsplit Tool}
%=================================================================
\label{sec_alogsplit}

The \app{alogsplit} tool will split a given \var{.alog} file into a directory
containing a file for each MOOS variable found in the \var{.alog} file. This 
is essentially the first stage of pre-processing done at the outset of launching
the \app{alogview} tool. It is implement here as a stand-alone app to be used
for purposes other than \app{alogview}. It may also be useful as a command-line
tool for preparing multiple \var{.alog} files from a shell script well before
the first time they are used in \app{alogview}. 

\pskip

\noindent
This tool in was introduced in Release 15.4 coinciding with the major
re-write of the \app{alogview} tool also released in 15.4.

%=================================================================
\subsection{Naming and Cleaning the Auto-Generated Split Directories}

The name of the {\em split directory} created by \app{alogsplit} is determined
automatically from the \var{.alog} filename. For a file name \var{alpha.alog}, 
the directory created will be \var{alpha\_alvtmp/} by default. This can be
overridden with the command line switch \var{--dir=my\_dirname}. The fairly 
distinctive \var{\_alvtmp} suffix was chosen to facilitate cleaning these 
auto-generated temporary directories with a simple shell script, \cmd{alvrm.sh}:

\vspace{0.1in}
\begin{fileverb}
#!/bin/bash
find . -name '*_alvtmp'  -print -exec rm -rfv {} \;
\end{fileverb}
\vspace{0.1in}

\noindent
The above script is found in the \var{moos-ivp/scripts} directory and
will remove (without prompting for confirmation) all split directories
in the current directory and sub-directories.

\begin{consoleverb}
 $ alvrm.sh -d -v
\end{consoleverb}


%=================================================================
\subsection{Command Line Usage for the alogsplit Tool}

\begin{consoleverb}
 $ alogsplit --help or -h
\end{consoleverb}

\vspace{0.1in}
\begin{listing}{Command line usage for the \app{alogsplit} tool}
\label{alogsplit_usage}
\scriptsize
\begin{verbatim}
  1  $ alogsplit -h
  2  
  3  Usage: 
  4    alogsplit in.alog [OPTIONS]                              
  5                                                             
  6  Synopsis:                                                  
  7    Split the given alog file into a directory, within which 
  8    each MOOS variable is split into it's own (klog) file    
  9    containing only that variable. The split will also create
 10    a summary.klog file with summary information.            
 11                                                             
 12    Given file.alog, file_alvtmp/ directory will be created. 
 13    Will not overwrite directory if previously created.      
 14    This is essentially the operation done at the outset of  
 15    launching the alogview applicaton.                       
 16                                                             
 17  Standard Arguments:                                        
 18    in.alog  - The input logfile.                            
 19                                                             
 20  Options:                                                   
 21   -h,--help      Displays this help message                
 22   -v,--version   Displays the current release version      
 23   --verbose      Show output for successful operation      
 24   --dir=DIR      Override the default dir with given dir.  
 25                                                          
 26   --max_fptrs=N  Set max number of OS file pointers allowed
 27                  to be open during splitting. Default 125. 
 28                                                          
 29   --detached=var:key  Split out key from complext var post 
 30                                                          
 31   --web,-w   Open browser to:                              
 32              https://oceanai.mit.edu/ivpman/apps/alogsplit 
 33                                                          
 34  Further Notes:                                             
 35   (1) The order of arguments is irrelevant.                
 36   (2) See also: alogscan, alogrm, aloggrep, alogclip,      
 X137       alogview 
\end{verbatim}
\end{listing}
\normalsize

%=================================================================
\subsection{Example Output from the alogsplit Tool}

The output shown in Listing \ref{alogsplit_output} was generated from
the \var{alpha.alog} file generated by the Alpha example mission.

\vspace{0.1in}
\begin{listing}{Example \app{alogsplit} directory applied to the \var{alpha.alog} file}
\label{alogsplit_output}
\scriptsize
\begin{verbatim}
  1  $ alogsplit alpha.alog
  2  
  3  APPCAST.klog                  IVPHELM_CPU.klog              NODE_REPORT_LOCAL.klog
  4  APPCAST_REQ.klog              IVPHELM_CREATE_CPU.klog       PHELMIVP_ITER_GAP.klog
  5  APPCAST_REQ_ALL.klog          IVPHELM_DOMAIN.klog           PHELMIVP_ITER_LEN.klog
  6  APPCAST_REQ_ALPHA.klog        IVPHELM_IPF_CNT.klog          PLOGGER_CMD.klog
  7  BHV_IPF_waypt_return.klog     IVPHELM_ITER.klog             PMARINEVIEWER_ITER_GAP.klog
  8  BHV_IPF_waypt_survey.klog     IVPHELM_LIFE_EVENT.klog       PMARINEVIEWER_ITER_LEN.klog
  9  CYCLE_INDEXd.klog              IVPHELM_LOOP_CPU.klog         PMV_CONNECT.klog
 10  CYCLE_INDEX_SURVEYING.klog    IVPHELM_MODESET.klog          PNODEREPORTER_ITER_GAP.klog
 11  DB_CLIENTS.klog               IVPHELM_REGISTER.klog         PNODEREPORTER_ITER_LEN.klog
 12  DB_EVENT.klog                 IVPHELM_STATE.klog            PROC_WATCH_EVENT.klog
 13  DB_QOS.klog                   IVPHELM_STATEVARS.klog        PROC_WATCH_FULL_SUMMARY.klog
 14  DB_RWSUMMARY.klog             IVPHELM_SUMMARY.klog          PROC_WATCH_SUMMARY.klog
 15  DB_TIME.klog                  LOGGER_DIRECTORY.klog         PROC_WATCH_TIME_WARP.klog
 16  DB_UPTIME.klog                MOOS_DEBUG.klog               RETURN.klog
 17  DEPLOY.klog                   MOOS_MANUAL_OVERRIDE.klog     SIMULATION_MODE.klog
 18  DESIRED_HEADING.klog          NAV_DEPTH.klog                TRUE_X.klog
 19  DESIRED_RUDDER.klog           NAV_HEADING.klog              TRUE_Y.klog
 20  DESIRED_SPEED.klog            NAV_HEADING_OVER_GROUND.klog  UPROCESSWATCH_ITER_GAP.klog
 21  DESIRED_THRUST.klog           NAV_LAT.klog                  UPROCESSWATCH_ITER_LEN.klog
 22  HELM_MAP_CLEAR.klog           NAV_LONG.klog                 USIMMARINE_ITER_GAP.klog
 23  IVPHELM_ALLSTOP.klog          NAV_PITCH.klog                USIMMARINE_ITER_LEN.klog
 24  IVPHELM_ALLSTOP_DEBUG.klog    NAV_SPEED.klog                USM_DRIFT_SUMMARY.klog
 25  IVPHELM_BHV_ACTIVE.klog       NAV_SPEED_OVER_GROUND.klog    USM_FSUMMARY.klog
 26  IVPHELM_BHV_CNT.klog          NAV_X.klog                    VISUALS.klog
 27  IVPHELM_BHV_CNT_EVER.klog     NAV_Y.klog                    summary.klog
 28  IVPHELM_BHV_IDLE.klog         NAV_YAW.klog
 29  IVPHELM_BHV_RUNNING.klog      NAV_Z.klog
\end{verbatim}
\end{listing}
\normalsize

\noindent
Notice the \var{summary.klog} file on line 27. It contains some meta
information gathered during the split process that is useful for
\cmd{alogview} in fetching information at run time.

%=================================================================
\subsection{Using the Detached Variable Option}

Certain string log entries may be in the format of multi-part comma-separated
pairs (CSP). For example:

\vspace{0.1in}
\begin{fileverb}
  REPORT =  x=77, y=99, speed=3.2, depth=4.5, heading=93, battery_level=16.4
\end{fileverb}
\vspace{0.1in}

\noindent
Normally \cmd{alogsplit} would create a single \var{.klog} file,
\var{REPORT.klog}.  However, one or more fields may be desired for
splitting out into their own \var{.klog} file. With the optional
\var{--detached=VARNAME} command line argument, the variable
\var{VARNAME} will be parsed and separate \var{.klog} files created
for sub-components of the contents of the string. For example, the
following argument:

\vspace{0.1in}
\begin{consoleverb}
  $ alogsplit --detached=REPORT file.alog
\end{consoleverb}
\vspace{0.1in}

\noindent
would create the following \var{.klog} files:

\vspace{0.1in}
\begin{consoleverb}
  REPORT:x.klog
  REPORT:y.klog
  REPORT:speed.klog
  REPORT:depth.klog
  REPORT:heading.klog
  REPORT:batter_level.klog
\end{consoleverb}
\vspace{0.1in}

\noindent
If the run-time speed of \cmd{alogsplit} is a concern, especially on
very large files, the above action can be quickened by isolating just
the sub-component of interest:


\vspace{0.1in}
\begin{consoleverb}
  $ alogsplit --detached=REPORT:speed file.alog
\end{consoleverb}
\vspace{0.1in}

\noindent
would create just the following \var{.klog} file:

\vspace{0.1in}
\begin{consoleverb}
  REPORT:speed.klog
\end{consoleverb}
\vspace{0.1in}

\noindent
If two or more sub-components are desired, the following two equivalent invocations
could be used:

\vspace{0.1in}
\begin{consoleverb}
  $ alogsplit --detached=REPORT:speed --detached=REPORT:depth file.alog
  $ alogsplit --detached=REPORT:speed:depth file.alog
\end{consoleverb}
\vspace{0.1in}

\noindent
would create just the following two \var{.klog} files:

\vspace{0.1in}
\begin{consoleverb}
  REPORT:speed.klog
  REPORT:depth.klog
\end{consoleverb}
\vspace{0.1in}

\noindent
Although \cmd{alogsplit} is its own stand-alone command-line utility,
the functionality of splitting is largely used as a pre-cursor step
when \cmd{alogview} is launched. As such, all the above command-line
options are also relevant when launching \cmd{alogview}.  For example:

\vspace{0.1in}
\begin{consoleverb}
$ alogview --detached=REPORT file.alog
\end{consoleverb}
\vspace{0.1in}

\noindent
As \cmd{alogview} is launched, the first step after launch will be the
creation of the \var{\_alvtmp} directories.  If a detached variable is
named, e.g., a file like \var{REPORT:depth.klog} is created, then
\cmd{alogview} will now have this as a pull-down menu option for
plotting.

\vspace{0.1in}
\noindent
Note, if the string is in JSON format, e.g.

\vspace{0.1in}
\begin{fileverb}
  REPORT =  {"x":77, "y":99, "speed":3.2, "depth":4.5, "heading":93}
\end{fileverb}
\vspace{0.1in}

\noindent
then \cmd{alogview} will internally convert this into CSP format, and
will handle accordingly.

</pre></body></html>