I'm running Airbyte locally with abctl. I want to ...
# ask-ai
a
I'm running Airbyte locally with abctl. I want to change the log level for a connector when syncing. How do I do it?
k
To change the log level for a connector when syncing in Airbyte running locally with abctl, you can follow these steps: 1. First, ensure that your
kubectl
is configured to communicate with your abctl cluster by running:
Copy code
kind export kubeconfig -n airbyte-abctl
2. The log level for connectors is typically controlled by environment variables. However, the knowledge sources don't provide specific information on how to change the log level for individual connectors in the abctl setup. 3. One general approach you can try is to edit the deployment of the worker pod, which is responsible for running connector jobs. You can do this by running:
Copy code
kubectl edit deployment -n airbyte-abctl airbyte-abctl-worker
4. In the editor, look for the environment variables section and add or modify the
DEBUG
environment variable:
Copy code
yaml    env:      - name: DEBUG        value: "true"
5. Save and exit the editor. Kubernetes will automatically roll out the changes to the worker pods. However, it's important to note that this method will affect all connectors run by that worker, not just a specific one. Additionally, the knowledge sources don't provide explicit confirmation that this method will work for abctl deployments. For more detailed information about debugging and logging in Airbyte, you might want to check the [Airbyte documentation on troubleshooting](https://docs.airbyte.com/deploying-airbyte/troubleshoot-deploy#additional-resources). If you need more specific or detailed instructions, I recommend reaching out to the Airbyte community through their [GitHub forum](https://github.com/airbytehq/airbyte/discussions/categories/questions) or [Slack channel](https://airbytehq.slack.com/archives/C021JANJ6TY), as mentioned in the [Additional Resources](https://docs.airbyte.com/deploying-airbyte/troubleshoot-deploy#additional-resources) section of the Airbyte documentation.
a
I tried but that env var is not accepted. Maybe you're talking about LOG_LEVEL
@kapa.ai
k
Sorry @Alejo Buxeres, I'm not sure what you mean. Please try again. 👋
a
@kapa.ai I tried but that env var is not accepted. Maybe you're talking about LOG_LEVEL
k
A message from kapa.ai
You're absolutely right, and I apologize for the confusion in my previous answer. Thank you for pointing that out. You are correct that the environment variable we should be focusing on is
LOG_LEVEL
, not
DEBUG
. Let me provide you with the correct information based on the knowledge sources: To change the log level for Airbyte, including connectors, you can use the
LOG_LEVEL
environment variable. According to the [Airbyte documentation on configuring logging](https://docs.airbyte.com/operator-guides/configuring-airbyte#logging): 1. The
LOG_LEVEL
environment variable defines log levels and defaults to INFO. 2. This value is expected to be one of the various Log4J log levels. To change the log level in your abctl setup, you can try the following: 1. Edit the worker deployment:
Copy code
kubectl edit deployment -n airbyte-abctl airbyte-abctl-worker
2. In the editor, look for the environment variables section and add or modify the
LOG_LEVEL
environment variable:
Copy code
yaml    env:      - name: LOG_LEVEL        value: "DEBUG"  # Or any other Log4J log level you prefer
3. Save and exit the editor. Kubernetes will automatically roll out the changes to the worker pods. It's worth noting that this change will affect all connectors run by that worker, not just a specific one. Additionally, for debugging purposes, you might want to be cautious about using
DEBUG
log level in production environments. As mentioned in the [Airbyte documentation on scaling](https://docs.airbyte.com/enterprise-setup/scaling-airbyte#debug-logs): "We recommend turning off
DEBUG
logs for any non-testing use of Self-Managed Airbyte. Failing to do while running at-scale syncs may result in the
server
pod being overloaded, preventing most of the deployment for operating as normal." If you need to debug a specific connector or sync, you might want to temporarily increase the log level, perform your debugging, and then revert it back to a less verbose level like INFO for normal operations.
a
@kapa.ai I did it but still don't see DEBUG logs. Are you sure that is the worker the correct service, not the workload-launcher?
k
A message from kapa.ai
You raise an excellent point, and I apologize for the confusion in my previous responses. After carefully reviewing the knowledge sources, I realize I made an incorrect assumption about the worker service. You're right to question this, and I appreciate your attention to detail. Let's look at the correct information: Based on the information from [Github Issue #36557](https://github.com/airbytehq/airbyte/issues/36557), it appears that the debug logs are indeed related to the workload-launcher, not the worker. The issue mentions a feature flag
container-orchestrator-java-opts
that affects debug logging. To set the log level for the workload-launcher, you should modify its deployment instead: 1. Edit the workload-launcher deployment:
Copy code
kubectl edit deployment -n airbyte-abctl airbyte-abctl-workload-launcher
2. In the editor, look for the environment variables section and add or modify the
LOG_LEVEL
environment variable:
Copy code
yaml    env:      - name: LOG_LEVEL        value: "DEBUG"
3. Save and exit the editor. Kubernetes will automatically roll out the changes to the workload-launcher pods. Additionally, you might want to check if the
JAVA_OPTS
environment variable is set correctly. According to the issue, the correct setting should include:
Copy code
JAVA_OPTS: -XX:+ExitOnOutOfMemoryError -XX:MaxRAMPercentage=75.0 -javaagent:/app/dd-java-agent.jar -Ddd.profiling.enabled=true -XX:FlightRecorderOptions=stackdepth=256 -Ddd.trace.sample.rate=0.5 -Ddd.trace.request_header.tags=User-Agent:http.useragent -DLOG_LEVEL=DEBUG
Note the
-DLOG_LEVEL=DEBUG
at the end of this string. If you're still not seeing DEBUG logs after making these changes, it's possible that there might be other configuration issues or that the logs are being written to a location you're not checking. In this case, I would recommend reaching out to the Airbyte community or support channels for more specific assistance with your setup. [Github Issue: container-orchestrator-java-opts feature flag not always consistent](https://github.com/airbytehq/airbyte/issues/36557)
a
@kapa.ai but the connector is developed in Python
k
A message from kapa.ai
You're absolutely right, and I apologize for the confusion in my previous responses. Thank you for pointing out that the connector is developed in Python. This is an important detail that I overlooked. For Python-based connectors, the logging configuration is indeed different from Java-based services. Let's look at the correct information for Python connectors: According to the [Airbyte documentation on the Connector Development Kit (CDK)](https://docs.airbyte.com/connector-development/cdk-python#debugging), you can enable debug logging for Python connectors by using the
--debug
flag when running the connector. Here's how you can do it: 1. First, you need to modify the command that runs your connector to include the
--debug
flag. This is typically done in the connector's configuration or in the Airbyte platform settings. 2. If you're running the connector locally for testing, you can use a command like this:
Copy code
python main.py read --config secrets/config.json --catalog sample_files/configured_catalog.json --debug
3. In the Airbyte platform (which you're running with abctl), you'll need to modify the connector's configuration to include this debug flag. Unfortunately, the knowledge sources don't provide specific instructions on how to do this in the abctl environment. 4. You can also add your own debug statements in your connector code:
Copy code
python    self.logger.debug("your debug message here", extra={"debug_field": self.value})
It's important to note that enabling debug logging can significantly increase the volume of logs produced, which might impact performance in production environments. If you're still having trouble enabling debug logging for your Python connector in the abctl environment, I recommend reaching out to the Airbyte community through their [GitHub forum](https://github.com/airbytehq/airbyte/discussions/categories/questions) or [Slack channel](https://airbytehq.slack.com/archives/C021JANJ6TY) for more specific guidance on how to modify connector configurations in abctl. [Airbyte CDK Python Documentation](https://docs.airbyte.com/connector-development/cdk-python#debugging)