Log Commands

You can use the command line to perform the following actions on logs:

  • Deleting Logs in Bulk
  • Exporting Log Data to CSV File
  • Archiving Logs

Deleting Logs in Bulk

Deletes logs generated earlier than the specified date.

Command
delete_loggings.csp
Parameters
Parameters Required item Description
exec   Deletes the data.
If omitted, the number of logs to be deleted is displayed. Data are not deleted.
before   The input type of this argument is a string (one line). Type YYYY-MM-DD.
Specify the date that the data to delete based on.
The log data that was generated earlier than the specified date will be deleted.
If omitted, all logs will be deleted.
max_duration   The input type of this argument is an integer.
Specify the maximum amount of time to perform the deletion process in minutes. If the deletion process continues after the specified period of time, the process ends.
To use this argument, you must use exec.
  • Minimum value: 1
  • Maximum value: 2147483647
help   Displays help for this command.
Execution Example

Assuming the example setting below, the command usage is as follows:

  • Delete data before: 2011
  • The maximum duration of the deletion process: 3 hours (180 minutes)

On Windows:

.\grn.exe -C -q code\command\delete_loggings.csp exec before=2011-05-30 max_duration=180
On Linux:
./grn.cgi -C -q code/command/delete_loggings.csp exec before=2011-05-30 max_duration=180

Exporting Log Data to CSV Files

Exports the log data to a CSV file.

Command
export_loggings.csp
Parameters
Parameters Required item Description
before The input type of this argument is a string (one line). Type YYYY-MM-DD.
Specify the date that the data to export CSV file based on.
Exports logs generated earlier than the specified date to a CSV file.
charset   Specify the character encoding of the CSV file to export. Youo can use the following character codes:
  • SJIS-win
  • UTF-8
  • ASCII
  • ISO-8859-1
  • GB2312
  • TIS-620
If omitted, the value in "default_external_encoding" of the config file common.ini is used. The default value is SJIS-win.
title   Specify one of the following values:
  • YES
    The item name is exported to the first row of the CSV file.
  • No
    The item name is not exported to the CSV file.
If omitted, the item name will not be exported to the CSV file.
help   Displays help for this command.
Execution Example

Assuming the example setting below, the command usage is as follows:

  • Export data before: May 30, 2011
  • Character encoding: UTF-8
  • Header row: Exported item name
  • Destination file name: Logdata.csv

On Windows:

.\grn.exe -C -q code\command\export_loggings.csp before=2011-05-30 charset=UTF-8 title=YES > logdata.csv
On Linux:
./grn.cgi -C -q code/command/export_loggings.csp before=2011-05-30 charset=UTF-8 title=YES > logdata.csv

Archiving Logs

Archive logs older than 91 days or more to a file. If the database does not have old logs, no archiving will be performed.

Command
archive_log.csp
Parameters
Parameters Required item Description
max_week   The input type of this argument is an integer.
Specify the time frame in week to archive logs from the oldest log. If omitted, three weeks are applied.
  • Minimum value: 1
  • Maximum Value: 50
help   Displays help for this command.
Execution Example

Assuming the example setting below, the command usage is as follows:

  • Archived Time Frame: 10 weeks from oldest output date

On Windows:

.\grn.exe -C -q code\command\archive_log.csp max_week=10
On Linux:
./grn.cgi -C -q code/command/archive_log.csp max_week=10