Connect to SumoLogic
Use the following step to connect to the SumoLogic instance.
Pre-requisite
Stop the Tomcat service if ThingWorx is already running.
Install Docker Engine (Docker Desktop). For more information, refer Install Docker Engine.
Download ThingWorx Docker files from the PTC Software download page. Extract the OpenTelemetry Collector docker-compose-otel-collector.override.yml files.
Complete ThingWorx Foundation installation. For more information, refer Setting Up, Building, and Configuring ThingWorx Docker.
OpenTelemetry Collector Docker to connect to SumoLogic with Standalone ThingWorx Docker setup 
1. Open thedocker-compose-otel-collector.override.yml.
a. Update the following parameters under x-platform section,
SUMOLOGIC_SOURCE: <SUMOLOGIC_SOURCE>
SUMOLOGIC_COLLECTOR: <SUMOLOGIC_COLLECTOR>
ENABLE_OPENTELEMETRY_FOR_LOGGING: true
b. Update the following parameters under x-otel-collector section,
OTEL_COL_OTLPHTTP_EXPORTER_ENDPOINT: <ENDPOINT_URL>
2. Run the following command to start ThingWorx server.
docker compose -f docker-compose-postgres.yml -f -docker-compose-otel-collector.override.yml up -d
3. To observe the logs, see How to access ThingWorx logs.
OpenTelemetry Collector Docker to connect to SumoLogic with High Availability Docker Setup 
1. Go to downloaded docker files and open cluster folder of any ThingWorx supported database.
2. Open the .env file in edit mode. For example, PostgreSQL file can be located at, \docker-compose-postgres-clustered\.env.
3. Set the ENABLE_OPENTELEMETRY_FOR_LOGGING to true.
4. Add or update the following parameters in Sumologic configuration section.
SUMOLOGIC_SOURCE: <SUMOLOGIC_SOURCE>
SUMOLOGIC_COLLECTOR: <SUMOLOGIC_COLLECTOR>
5. Add or update the following parameters in OpenTelemetry Collector section.
OTEL_COL_OTLPHTTP_EXPORTER_ENDPOINT: <ENDPOINT_URL>
6. Run the following command to start ThingWorx server.
docker compose -f docker-compose-postgres.yml -f docker-compose-otel-collector.override.yml up -d
7. To observe the logs, see How to access ThingWorx logs.
* 
Wait for few minutes and make sure OpenTelemetry image is pulled through ThingWorx docker files. There should be separate OpenTelemetry collector up and running.
How to access ThingWorx logs 
1. Access the ThingWorx Composer URL.
2. Go to the Composer > Subsystems > LoggingSubsystem > Configuration > Log Retrieval Strategy section.
3. Verify the log retrieval strategy Thing name is set to DefaultLogRetrievalStrategyThing.
4. Open the DefaultLogRetrievalStrategyThing entity and go to Configuration page.
5. Update Search Job API URL, Access ID, Access Key and Response Timeout In Seconds for SumoLogic instance. Click Save.
6. Import the extension and create a Thing from the imported ThingShape. For more information on creating a custom Log Retrieval strategy ThingShape, see Custom Log Retrieval Strategy for Querying Logs from external sources.
7. Wait and observe the logs in SumoLogic.
8. Open the Composer > Monitoring and observe specific logs.
* 
To enable logs from SumoLogic, see OpenTelemetry Configuration.
OpenTelemetry Collector Docker to connect to SumoLogic with ThingWorx installed through installer 
1. Create the following environment variables:
SUMOLOGIC_SOURCE: <SUMOLOGIC_SOURCE>
SUMOLOGIC_COLLECTOR: <SUMOLOGIC_COLLECTOR>
NAMESPACE: <NAMESPACE>
2. Create your own docker-compose.yaml file and add the following lines.
version: '2.4'
services:
otel-collector:
image: otel/opentelemetry-collector-contrib:0.93.0
volumes:
- <path to the downloaded conf/otel-config.yaml file>:/config.yaml
# Configure the following files in accordance with the TLS/mTLS settings specified in the 'otel-config.yaml' file.
# - ./conf/client.crt:/client.crt
# - ./conf/client.key:/client.key
# - ./conf/server.crt:/server.crt
ports:
- 4317:4317
# - 8881:8881 # to view internal otel internal metrics
command: ["--config=/config.yaml"]
environment:
NAMESPACE: <NAMESPACE>
OTEL_COL_OTLP_RECEIVER_GRPC_ENDPOINT: 4317
OTEL_COL_OTLPHTTP_EXPORTER_ENDPOINT: <SUMOLOGIC ENDPOINT URL >
OTEL_COL_BATCH_PROCESSOR_SEND_BATCH_SIZE: 8192
OTEL_COL_BATCH_PROCESSOR_TIMEOUT: 200ms
OTEL_COL_MEMORY_LIMITER_PROCESSOR_CHECK_INTERVAL: 3s
OTEL_COL_MEMORY_LIMITER_PROCESSOR_LIMIT_PERCENTAGE: 75
OTEL_COL_MEMORY_LIMITER_PROCESSOR_SPIKE_LIMIT_PERCENTAGE: 30
OTEL_COL_OTLPHTTP_EXPORTER_RETRY_ON_FAILURE_INIT_INTERVAL: 5s
OTEL_COL_OTLPHTTP_EXPORTER_RETRY_ON_FAILURE_MAX_INTERVAL: 30s
OTEL_COL_OTLPHTTP_EXPORTER_RETRY_ON_FAILURE_MAX_ELAPSED_TIME: 300s
OTEL_COL_OTLPHTTP_EXPORTER_SENDING_QUEUE_NUM_CONSUMERS: 10
OTEL_COL_OTLPHTTP_EXPORTER_SENDING_QUEUE_SIZE: 1000
OTEL_COL_OTLPHTTP_EXPORTER_TIMEOUT: 5s
a. Make sure you have updated the endpoint URL for the parameter OTEL_COL_OTLPHTTP_EXPORTER_ENDPOINT.
b. Make sure NAMESPACE value is same as the system environment variable.
c. Make sure <path to config/otel-config.yaml file> is replaced with the actual file path., after downloading and extracting the docker files as mentioned in the pre-requisites.
4. Execute OpenTelemetry collector container using the following command.
docker-compose up -d
5. Go to the ThingWorx Foundation installation folder.
6. Open the platform-settings.json file in an editor.
7. Add the following settings:
a. Set the BasicSettings > EnableOpenTelemetryForLogging to true.
b. Add the following section.
"OpenTelemetrySettings": {
"BatchLogProcessorMaxQueueSize": "2048",
"BatchLogProcessorScheduledDelay": "10",
"BatchLogProcessorMaxExportBatchSize": "512",
"BatchLogProcessorExportTimeout": "1000",
"OtlpGRPCLogExporterEndpoint": "http://localhost:4317",
"OtlpGRPCEnableSSL": "false",
"OtlpGRPCTrustStorePath": "",
"OtlpGRPCTrustStorePassword": "",
"OtlpGRPCKeyStorePath": "",
"OtlpGRPCKeyStorePassword": "",
"RetryOtlpGRPCLogExporterMaxAttempts": "5",
"RetryOtlpGRPCLogExporterBackOffMultiplier": "1.5",
"RetryOtlpGRPCLogExporterInitialBackOff": "1",
"RetryOtlpGRPCLogExporterMaxBackOff": "5",
"OtlpGRPCMetricExporterEndpoint": "http://localhost:4317",
"EnableOpenTelemetryInternalMetrics": "true"
},
Confirm the OtlpGRPCLogExporterEndpoint URL.
8. Start the Tomcat service to start ThingWorx Foundation server.
9. To observe the logs, see How to access ThingWorx logs.
Was this helpful?