Logs of functions (TSv1, TSv2, Python, AIP Logic, ...) as a dataset for analysis with custom arguments?

I want to analyze the logs of the execution of some of my functions: TSv1, TSv2, Python, AIP Logic functions, etc.

I would like to understand what my users are calling those functions with (= “What are the usual inputs for my functions”) and what is the quality of the output of those functions (= “What are the output of my functions”). I would like to use this for retraining/prompt-tweaking/etc.

How can I get a dataset with “logs” of the executions of my functions of a given scope (e.g. project) ? Can I get the inputs/outputs of those functions ?

1 Like

Yes it is possible.

Logs as a dataset for analysis

A few components and things are needed.

1. The streaming dataset of logs of the functions
You can setup a stream dataset to receive the logs of all functions executed in a particular scope (e.g. a project).

This stream dataset should be created by organization administrator, and is per caller organization (who queries the functions) not per space (whenever this function is called, regardless of the source).
Given this can contain sensitive data (inputs/outputs of the calls) this is highly recommended to add security Markings to it.

Streaming dataset logging, see: https://www.palantir.com/docs/foundry/administration/configure-logging

2. Add logging to your functions
Logging, see: https://www.palantir.com/docs/foundry/aip-observability/service-logs-and-debugging/#permission-required

For typescript v1, any “console.log” will be visible in the logs/logging-dataset.
For typescript v2, you need to use a logger, like:

import { logs } from "@opentelemetry/api-logs";

const logger = logs.getLogger("helloWorld_loggintest");

function helloWorld_loggintest(): string {
    console.log("This is some log I would like to see in the datasets of logs ! SEARCHFORME")
    // TypeScript v2 example - Good logging practices
    logger.emit({
        severityText: "INFO",
        attributes: { LOG_MESSAGE: "ter This is some log I would like to see in the datasets of logs ! SEARCHFORME" }, // Include relevant IDs
        body: { },
    });
    return "Hello World!";
}

export default helloWorld_loggintest;

For Python, this is not yet (but should be soon) available.

From there, you will see the logs, including the custom logging, in the streaming dataset.

Example contour analysis on this dataset


Alternative - Workflow Lineage

Note that you can see the logs of your functions directly in Workflow Lineage:

You might want to configure the logs-access in Control Panel to allow all users to access all logs.
See https://palantir.com/docs/foundry/administration/configure-logging/#in-platform-log-access-for-ontology-and-aip-workflows and https://www.palantir.com/docs/foundry/aip-observability/log-permissioning

4 Likes

Hey

We have been actually parsing security logs for this. While we recognize this may not be the best pattern, we do this because we want to do this at scale.

We also use the Governance marketplace application for tracking functions.

Would you have any insight for how to do this at scale for many function types such as quiver?

I like this overall for individual products and will recommend that for other teams.