Hitachi

JP1 Version 12 JP1/IT Desktop Management 2 Administration Guide


10.9.1 Operating daily import of HIBUN logs

You can examine daily HIBUN logs reported from client PCs by importing them into the JP1/IT Desktop Management 2 operation log. The following procedure shows an example of operating these logs.

To operate the logs:

  1. Create a shared folder on the JP1/IT Desktop Management 2 management server, so that the HIBUN log relay server can access the folder.

  2. On the HIBUN log relay server, use the Windows Task Scheduler to execute HIBUN commands on a regular basis to output HIBUN logs in CSV format.

    The logs should be output to the folder for the HIBUN log relay server, with the path containing the command execution date in its name. Specify the different output destinations between HIBUN logs on the previous day and late-reported HIBUN logs (HIBUN logs older than or equal to two days ago). In this procedure, the output destination of the late-reported HIBUN logs is "the-command-execution-date_old".

  3. Copy the CSV file that was output in step 2 to the JP1/IT Desktop Management 2 management server.

    The file should be copied to the folder for the JP1/IT Desktop Management 2 management server, with the path containing the command execution date and the-command-execution-date_old in its name.

  4. Considering the time when the operations in steps 2 and 3 finish, execute the external log import command with the folders "the command execution date" and "the-command-execution-date_old" copied in step 3 as input.

    The HIBUN logs are now imported into JP1/IT Desktop Management 2.

    To acquire HIBUN logs on the previous day prior to the late-reported HIBUN logs, acquire logs in the order of "the command execution date" and "the-command-execution-date_old". Periodically delete the folder "the command execution date" and "the-command-execution-date_old".

HIBUN commands

The following example shows HIBUN commands you execute in step 2 of the To operate the logs section.

sflogcmd /m:in:administrator-name:password
sflogcmd /c:dc:"input-folder":"output-folder":UTF-8:c:b
sflogcmd /m:ot

The input-folder and output-folder should be specified as follows:

input-folder

HIBUN-log-relay-server-data-folder\User_Log\type-of-log\YYYY_MM\DD

The type-of-log should be specified as one of the following:

Access log: Access, Event log: Event, HIBUN extended operation log: OML

output-folder

any-folder\type-of-log_command-execution-date

For the type-of-log, the type of log designated in the input-folder should be specified.

Example of the batch file to execute HIBUN commands

The following example shows a batch file that outputs HIBUN access logs for three days stored in the data-folder-in-the-HIBUN-log-relay-server\User_Log\Access folder to the C:\work\HibunLog\Access\command-execution-date(in-YYYYMMDD-format) folder in CSV format when the date display format in the OS is set to yyyy/MM/dd. To output logs on the preveous day, describe "set IMPORTDAYS=2" on the second line and "set i=1" on the third line. To output logs for four days from two days ago, describe "set IMPORTDAYS=6" on the second line and "set i=2" on the third line.

@echo off
set IMPORTDAYS=3
set i=0
sflogcmd /m:in:administrator-name:password
:days_loop
set PERIOD=%i%
call :getpastdate
call :getcurrentdate
sflogcmd /c:dc:"HIBUN-log-relay-server-data-folder\User_Log\Access\%PASTDATE%":"C:\work\HibunLog\Access\%yy%%mm%%dd%":UTF-8:c:b
set /a i+=1
if %i% lss %IMPORTDAYS% goto days_loop
sflogcmd /m:ot
exit /b

rem Subroutine to return a date in the past (N days ago)
rem Set the number of days for the PERIOD variable and call the subroutine
rem Set the result (YYYY_MM\DD) for the PASTDATE variable
rem Set the current date for the yy, mm, and dd variables
:getpastdate

rem == Get the current date ==
call :getcurrentdate
set PASTDATE=%yy%_%mm%\%dd%
if %PERIOD% equ 0 exit /b

rem Calculate the date before the specified date
set n=0
:getpastdate_loop

set /a n=n+1
set /a dd=1%dd%-101
set dd=00%dd%
set dd=%dd:~-2%
set /a ymod=%yy% %% 4

rem == Operation for a new month or year ==
if %dd%==00 (
if %mm%==01 (set mm=12& set dd=31& set /a yy=%yy%-1)
if %mm%==02 (set mm=01& set dd=31)
if %mm%==03 (set mm=02& set dd=28& if %ymod%==0 (set dd=29))
if %mm%==04 (set mm=03& set dd=31)
if %mm%==05 (set mm=04& set dd=30)
if %mm%==06 (set mm=05& set dd=31)
if %mm%==07 (set mm=06& set dd=30)
if %mm%==08 (set mm=07& set dd=31)
if %mm%==09 (set mm=08& set dd=31)
if %mm%==10 (set mm=09& set dd=30)
if %mm%==11 (set mm=10& set dd=31)
if %mm%==12 (set mm=11& set dd=30)
)
if not %n% == %PERIOD% goto getpastdate_loop
set PASTDATE=%yy%_%mm%\%dd%
exit /b

rem Subroutine to get the current date
rem Set the result for the yy, mm, and dd variables
:getcurrentdate

rem == Get the current date ==
set dt=%date%
rem == For the yyyy/MM/dd format ==
set yy=%dt:~0,4%
set mm=%dt:~5,2%
set dd=%dt:~8,2%
exit /b

External log import command

The following example shows the external log import command you execute in step 4 of the To operate the logs section. The execution result of the command is redirected to the execution result output file for output.

ioutils importexlog -import input-folder -log type-of-HIBUN-log >> execution-result-output-file 2>>&1

The input-folder and the type-of-HIBUN-log should be specified in the following format:

input-folder

any-folder\type-of-log_command-execution-date

For the type-of-log, the type of log designated in the output-folder for the HIBUN command to be executed should be specified.

type-of-HIBUN-log

One of the following can be specified:

HA: HIBUN access log, HE: HIBUN event log, HO: HIBUN extended operation log

Example of the batch file to execute the external log import command

The following example shows a batch file that imports HIBUN access logs stored in the C:\work\HibunLog\Access\command-execution-date(in-YYYYMMDD-format) folder and outputs the execution result to the C:\log\HA_command-execution-date(in-YYYYMMDD-format).log when the date display format in the OS is set to yyyy/MM/dd.

@echo off
setlocal
call :getcurrentdate
ioutils importexlog -import C:\work\HibunLog\Access\%yy%%mm%%dd% -log HA >> C:\log\HA_%yy%%mm%%dd%.log 2>>&1
exit /b

rem Subroutine to get the current date
rem Set the result for the yy, mm, and dd variables
:getcurrentdate

rem == Get the current date ==
set dt=%date%
rem == For the yyyy/MM/dd format ==
set yy=%dt:~0,4%
set mm=%dt:~5,2%
set dd=%dt:~8,2%
exit /b

When HIBUN logs are imported from multiple HIBUN log relay servers

If you import HIBUN logs from multiple HIBUN log relay servers, create a folder for each log relay server that stores the CSV file, on the JP1/IT Desktop Management 2 management server.

Time to import HIBUN logs

When you execute the step 2 and 3 at 00:30 and execute the step 4 at 03:00 of the above "To operate the logs:", in the list view of operation logs, you can see the operation logs notified on the previous day.

Importing late-reported logs

A management target PC is sometimes brought to the outside of the company, and its logs cannot be reported to the HIBUN log relay server.

For example, if you want to import HIBUN logs that are reported one month later into JP1/IT Desktop Management 2, you need to output the HIBUN logs for one month as a CSV file and then use the external log import command to import the file.

Depending on the environment of the management server and the number of days for which HIBUN logs are to be acquired, it might take more than one day for HIBUN logs to be acquired. In this case, consider an operation to reduce the number of days for which HIBUN logs are to be acquired.

Operation in a multi-server configuration

When JP1/IT Desktop Management 2 is configured in the multi-server configuration, operate the system as follows:

  1. Copy the CSV file containing HIBUN logs to the management server that stores the operation logs.

  2. On the management server in step 1, execute the external log import command to import the HIBUN logs into JP1/IT Desktop Management 2.