Adding records
Note
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using --folder-name or --folder-id.
To add records to a log group, run this command:
- Linux, MacOS:
yc logging write \ --group-name=default \ --message="My message" \ --level=INFO \ --json-payload='{"request_id": "1234"}' - Windows (cmd):
yc logging write ^ --group-name=default ^ --message="My message" ^ --level=INFO ^ --json-payload="{"request_id": "1234"}" - Windows (PowerShell):
yc logging write ` --group-name=default ` --message="My message" ` --level=INFO ` --json-payload='"{ \"request_id\": \"1234\" }"'
Where:
--group-name: Name of the log group where you want to add records. If you leave it unspecified, the system will add records to the default log group in the current folder. You can specify--group-idinstead of--group-name.--message: Message.--level: Logging level.--json-payload: Additional information in JSON format.
You can skip the --group-name, --message, and --json-payload parameters and provide only the values in the right order, e.g., default "My message" '{"request_id": "1234"}'.
Note
It may take up to 60 seconds for records to appear in the log group because the system needs time to process them.
To add records to a log group, use the LogIngestionService/Write gRPC API call.