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:
-
Create a shared folder on the JP1/IT Desktop Management 2 management server, so that the HIBUN log relay server can access the folder.
-
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.
-
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 in its name.
-
Considering the time when the operations in steps 2 and 3 finish, execute the external log import command with the CSV file copied in step 3 as input.
The HIBUN logs are now imported into JP1/IT Desktop Management 2.
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.
@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
We recommend that the HIBUN logs are imported completely by 1:00#.
#: At this time, the indexes are re-created on the operation log database by default.
The operation log database can import up to about 5 million HIBUN logs per hour.
Also, the database can import the HIBUN logs several times a day. Once a log is imported into JP1/IT Desktop Management 2, it is not imported next time.
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 number of HIBUN logs to import, importing one-month logs during daily import operation may take time, possibly imposing a load on the system. To avoid such a situation, you can consider the operation where 7-day logs are imported on weekdays and 23-day logs are imported on weekends during which the system is at low load.
Operation in a multi-server configuration
When JP1/IT Desktop Management 2 is configured in the multi-server configuration, operate the system as follows:
-
Copy the CSV file containing HIBUN logs to the management server that stores the operation logs.
-
On the management server in step 1, execute the external log import command to import the HIBUN logs into JP1/IT Desktop Management 2.