Changing Output Destinations for Different Types of Logs using CLI
This topic contains information about how to configure output channels to send logs, access logs and metrics to Database, Forward, Elasticsearch, HTTP, Kafka, Syslog, generic TCP end points using command-line interface.
How to Use This Feature
This feature allows you to change the output destination for different types of logs in one invocation.
The command accepts a JSON that contains the different configuration properties. The data in the file should adhere to JSON rules. All properties are top-level attributes. See the examples below.
Command Line
The generic form of the command is:
clustermanager import config --componentType <component type> [-- componentId <componentId>] --file <full path to json>
For example:
cm import config [--componentId 3a076250-955b-49ef-ab06-ea19df10a665 --componentType logservice --file props.json
Types of Logs
Each type of log has a different set of property names. This way you can send different types of logs to different destinations.
The logs are written to the disk (DEFAULT) on the log service container irrespective of the destination you choose.
Importing Configurations From Cluster Manager Command Line Interface
- List components:
clustermanager ls components Using cluster [tml52clusterpune1] Using Zone [eastus] Component ID Type Name Status Last Heartbeat Received Host Service Port(s) ------------------------------------- --------------- ----------------- -------- ----------------------------- ---------- ---------------- f41c95b9-6059-42c1-8a4f-fb2261974c14 cache cache-set-0-0.cac... ACTIVE Mar 12 2020 08:59:09 +0000 10.244.1.6 11212,11211,11213,11214,11215,11216 710b9df4-399a-4551-b1ed-c1fc1f8ed744 configmanager cm-deploy-0-85fbf... ACTIVE Mar 12 2020 08:59:25 +0000 10.244.2.6 8080 c1057ef0-ab4e-459f-8413-0e5036c65b7c logservice log-set-0-0.log-s... ACTIVE Mar 12 2020 08:59:30 +0000 10.244.2.7 24224 d516fe9e-3ac3-4a09-a9b0-1dceba36a23d nosql cass-set-0-2.cass... ACTIVE Mar 12 2020 08:59:09 +0000 10.244.1.5 9042 29812c89-2e87-4dc0-a981-890cd1a72933 nosql cass-set-0-0.cass... ACTIVE Mar 12 2020 08:59:09 +0000 10.244.2.5 9042 99950720-6ded-46be-a87f-dc82be47f265 nosql cass-set-0-1.cass... ACTIVE Mar 12 2020 08:59:09 +0000 10.244.0.6 9042 8a5a78f0-f032-4046-ba59-28a75004c9ce sql mysql-set-0-0.mys... ACTIVE Mar 12 2020 08:59:34 +0000 10.244.2.8 3306 111628dc-7893-45c8-8add-8a7944a2ff8c trafficmanager tm-deploy-0-5f787... ACTIVE Mar 12 2020 08:59:28 +0000 10.244.0.7 8080
- Get the component ID of logservice from the output.
- Check the existing configuration.
clustermanager ls config --componentId c1057ef0-ab4e-459f-8413-0e5036c65b7c --componentType logservice clusterId [ad41097e-35bc-4fc4-bb22-084dc25fdbf2] and zoneId [9046178a-00f9-4d59-a92e-59824142df56] No settings found for the given componentId [c1057ef0-ab4e-459f-8413-0e5036c65b7c] of type [logservice]
- Create a JSON file for input (for example,/home/builder/property.json).
- Update the configuration by importing the JSON file.
clustermanager import config --componentId c1057ef0-ab4e-459f-8413-0e5036c65b7c --componentType logservice --file /home/builder/property.json Updating the TMGC after the change Successfully updated the TMGC component c1057ef0-ab4e-459f-8413-0e5036c65b7c for components of type logservice Successfully imported configuration properties for the scope map[cluster:tml52clusterpune1 component:c1057ef0-ab4e-459f-8413-0e5036c65b7c zone:eastus] for components of type logservice
For more information, see JSON Configuration Files Format for Different Outputs.