Log Search API
This API searches for log records from the HULFT Send Log, Receive Log, or Observe Log, based on the search conditions.
For details on the log file format, refer to Log file format.
Syntax
int hulrlog( char type, char status, char readmode,char *version, char *fileID,char *hostname,char search,char *startdate, char *starttime,char *enddate,char *endtime,char *data, int maxnum, int *matchnum )
The library for calling an API is stored in the file (library) named "libhulapi.a" in the "api" directory below the HULFT execution module storage directory (HULEXEP).
When this library is 32-bit mode, the module on the calling side must be compiled in 32-bit mode as well.
When this library is 64-bit mode, the module on the calling side must be compiled in 64-bit mode as well.
For compiling options, refer to the manual of your compiler or linker.
Explanation of the parameters
- char type (IN)
-
Specify the type of log to search
- S:
-
Send Log
- R:
-
Receive Log
- O:
-
Observe Log
- char status (IN)
-
Specify the status classification
- A:
-
All the log records are targeted and searched
- N:
-
Search for only log records for transfers that successfully ended
- E:
-
Search for only log records for transfers where errors occurred
- char readmode (IN)
-
Specify the search order
- N:
-
Search log records in order from oldest to newest
- R:
-
Search log records in order from newest to oldest
- char *version (IN)
-
Specify the version information of HULFT in the log format to be output
Specify one of the following:
-
V07L00
-
V08L00
-
V08L01
-
V08L04
-
- char *fileID (IN)
-
Specify the file ID or the service name to search for
Specify a character string within 50 bytes.
To omit this parameter, specify the value "0x00" as the first byte, or specify a NULL pointer to the parameter.
- char *hostname (IN)
-
Specify the host name to search for
Specify a character string within 68 bytes.
To omit this parameter, specify the value "0x00" as the first byte, or specify a NULL pointer to the parameter.
- char search (IN)
-
Reserved for future use
Be sure to specify 'E.'
- char *startdate (IN)
-
Specify the start date of the search range
Specify 8 bytes of character string. The format is YYYYMMDD. The date format must be the same as Date Format (datefmt) that is specified in the System Environment Settings. For details, refer to Administration Manual.
To omit this parameter, specify the value "0x00" as the first byte, or specify a NULL pointer to the parameter.
- char *starttime (IN)
-
Specify the start time of the search range
Specify 6 bytes of character string. The format is HHMMSS.
You cannot specify this parameter if you omit the specification of the start date.
To omit this parameter, specify the value "0x00" as the first byte, or specify a NULL pointer to the parameter.
- char *enddate (IN)
-
Specify the end date of the search range
Specify 8 bytes of character string. The format is YYYYMMDD. The date format must be the same as Date Format (datefmt) that is specified in the System Environment Settings. For details, refer to Administration Manual.
To omit this parameter, specify the value "0x00" as the first byte, or specify a NULL pointer to the parameter.
- char *endtime (IN)
-
Specify the end time of the search range
Specify 6 bytes of character string. The format is HHMMSS. You cannot specify this parameter if you omit the specification of the end date.
To omit this parameter, specify the value "0x00" as the first byte, or specify a NULL pointer to the parameter.
- char *data (IN/OUT)
-
Specify a pointer that shows the buffer where the search results are stored
Before hulrlog() is called, an array whose size is calculated by the formula 'Max. Retrieval Cases x (record length + 1)' must be allocated for a buffer.
The various dates of the acquired information are converted into the format that is set for Date Format in the System Environment Settings. The converted dates are stored in the buffer as the image of the log file format.
When multiple log records are obtained, they are separated by a delimiter (0x0a).
For details on the log file format and the record length, refer to Formats of log files that are output by API.
- int maxnum (IN)
-
Specify the Max. Retrieval Cases
Specify a value of 1 or more.
- int *matchnum (OUT)
-
Specify the pointer that shows the buffer where the number of searched records is stored
Returned Value
- 0:
-
Search successful and complete
- 1:
-
Search successful but records remain
- 2:
-
No relevant information
- 3:
-
Parameter error
- 4:
-
Log file access error
- 5:
-
Memory error
- 99:
-
System error
Note
If you specify a search range for startdate, starttime, enddate, or endtime, the combinations of the log to be searched and the date or time used as a search key are as follows:
Log to Be Searched |
Date or Time Used as Search Key |
---|---|
Send Log |
Send End Date and Time |
Receive Log |
Receive End Date and Time |
Observe Log |
Observed Date and Time |
<Usage example>
When used from C
void hulrlog_proc(){ /* Variable definition */ char type; char status; char readmode; char *version; char *fileID; char *hostname; char search; char *startdate; char *starttime; char *enddate; char *endtime; char data[(3879+1)*10]; /* Securing the buffer for record length for single log record x maximum number of searchable records in Send Log */ int maxnum; int matchnum; int Status; Status = 0; /* status initialization */ type = 'S'; /* log type (Send Log) */ status = 'E'; /* acquire log with abnormal termination */ readmode = 'R'; /* search in new log order */ version = "V08L04"; /* version of HULFT in use */ fileID = "SEND000123456789"; /* specification of File ID */ hostname = "host0001"; /* specification of Host name */ search = 'E'; /* reserved area */ startdate = "20180801"; /* Date that is start point of search range */ starttime = "120000"; /* Time that is start point of search range */ enddate = "20180831"; /* Date that is end point of search range */ endtime = "120000"; /* Time that is end point of search range */ maxnum = 10; /* Max retrieval cases */ memset( data, 0, sizeof( data ) ); /* buffer data initialization */ /* start of log search */ Status=hulrlog( type,status,readmode,version,fileID,hostname, search,startdate,starttime,enddate,endtime,data,maxnum,&matchnum); if ( Status > 0 ) { printf( "error occurred (Status = %d)\n", Status ); }else{ printf( "%d cases searched \n", matchnum); } return; }