Create Logger

Creates a new logger. Administrator privileges are required to call this API.

Required Permissions

Requires the ADMIN role or higher.

HTTP Request

POST /api/sonar/loggers
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -d model_guid="cd09ae6f-fbc3-11ed-9320-02d178f999a6" \
     -d name="WTMP" \
     -d node_pair_guid="27102ae5-3698-44d4-aad5-4f2def80f275" \
     -d table_name="WTMP" \
     -d interval=5000 \
     -d 'configs={"path": "/var/log/wtmp"}' \
     -X POST https://HOSTNAME/api/sonar/loggers
Request Parameters
KeyRequiredTypeDescriptionNote
guidNoStringLogger identifier36-characters GUID. If not specified, randomly generated.
model_guidYesStringLogger model identifier36-characters GUID
nameYesStringLogger nameMinimum 1 to maximum 50 characters.
descriptionNoStringLogger descriptionMaximum 2,000 characters
node_pair_guidNoStringNode pair identifier36 characters
table_nameYesStringTable name
sentry_guidNoStringSentry identifier
intervalNo32-bit integerLogger intervalMinimum 1000 (Unit: milliseconds)
cron_scheduleNoStringLogger scheduleCRON schedule expression
asset_guidNoStringAsset identifierAsset IP address
configsNoKey/value stringConfiguration detailsSee Get Logger Factory Options.
group_guidNoStringLogger group GUID36 characters
encryptionNoBooleanWhether table encryption is enabled

Success Response

{
  "guid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

Error Responses

Required argument is missing

HTTP status code 400

{
  "error_code": "null-argument",
  "error_msg": "name should be not null"
}
Identifier is not in valid GUID format

HTTP status code 400

{
  "error_code": "invalid-param-type",
  "error_msg": "model_guid should be guid type."
}
Invalid argument length

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "'name' must be shorter than or equal to 50 characters"
}
Invalid table name format

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "table name must begin with a letter and may contain alphanumeric and underscore characters: 1WTMP"
}
CRON schedule expression is not valid

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "wrong cron expression format: * * * *"
}
Logger model is not found

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "logger model not found: bd09ae6f-fbc3-11ed-9320-02d178f999a6"
}
Node pair is not found

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "node pair not found: 37102ae5-3698-44d4-aad5-4f2def80f275"
}
Asset is not found

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "asset not found: cd09ae6f-fbc3-11ed-9320-02d178f999a6"
}
Logger name is duplicated

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "duplicated logger name: WTMP"
}
Permission denied

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "no-permission"
}