Summary

The createUploadFileAction() mutation creates an upload file action in a LogScale repository or view. When an alert or scheduled search triggers an upload file action, LogScale uploads a file — such as a CSV lookup table — to the target repository. The action supports two modes: replace mode overwrites the entire file, and update mode merges rows based on specified key columns. After creating the action, use updateUploadFileActionV2() to modify it or testUploadFileAction() to verify its behavior.

Syntax

graphql
createUploadFileAction(
      input: CreateUploadFileAction!
   ): UploadFileAction!

The mutation accepts a single required input argument of type CreateUploadFileAction!, which specifies the target view, the action name, the file name, the update mode, and optional key columns for row-level merging. See the Input Parameters section for the full list of fields.

The mutation returns a non-nullable UploadFileAction! object representing the newly created action. See the Returned Values section for the available fields.

Example

Raw
graphql
mutation {
  createUploadFileAction(input:
       { name: "my-search-link", 
         viewName: "humio",
         fileName: "somefile.csv"
      } )
  { id }
}
Mac OS or Linux (curl)
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  createUploadFileAction(input:
       { name: \"my-search-link\", 
         viewName: \"humio\",
         fileName: \"somefile.csv\"
      } )
  { id }
}"
}
EOF
Mac OS or Linux (curl) One-line
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  createUploadFileAction(input:
       { name: \"my-search-link\", 
         viewName: \"humio\",
         fileName: \"somefile.csv\"
      } )
  { id }
}"
}
EOF
Windows Cmd and curl
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json" ^
    -d @'{"query" : "mutation { ^
  createUploadFileAction(input: ^
       { name: \"my-search-link\",  ^
         viewName: \"humio\", ^
         fileName: \"somefile.csv\" ^
      } ) ^
  { id } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  createUploadFileAction(input:
       { name: \"my-search-link\", 
         viewName: \"humio\",
         fileName: \"somefile.csv\"
      } )
  { id }
}"
}'
    "$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $query = "mutation {
  createUploadFileAction(input:
       { name: \"my-search-link\", 
         viewName: \"humio\",
         fileName: \"somefile.csv\"
      } )
  { id }
}";
$query =~ s/\n/ /g;
my $json = sprintf('{"query" : "%s"}',$query);
my $req = HTTP::Request->new("POST", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");

$req->content( $json );

my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/graphql'
mydata = r'''{"query" : "mutation {
  createUploadFileAction(input:
       { name: \"my-search-link\", 
         viewName: \"humio\",
         fileName: \"somefile.csv\"
      } )
  { id }
}"
}'''

resp = requests.post(url,
                     data = mydata,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

const data = JSON.stringify(
    {"query" : "mutation {
  createUploadFileAction(input:
       { name: \"my-search-link\", 
         viewName: \"humio\",
         fileName: \"somefile.csv\"
      } )
  { id }
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL',
  path: 'graphql',
  port: 443,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length,
    Authorization: 'BEARER ' + process.env.TOKEN,
    'User-Agent': 'Node',
  },
};

const req = https.request(options, (res) => {
  let data = '';
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {
    data += d;
  });
  res.on('end', () => {
    console.log(JSON.parse(data).data);
  });
});

req.on('error', (error) => {
  console.error(error);
});

req.write(data);
req.end();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "createUploadFileAction": {
      "id": "abc123"
    }
  }
}

Input Parameters

The input argument accepts a CreateUploadFileAction object. Provide the target view name, the action name, the file name, and optionally labels, an update mode, and key columns. When updateMode is set to Update, you must also provide keyColumns and keyColumnsIgnoreCase.

Table: CreateUploadFileAction Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
fileNameStringyes Long-Term The file name to use for the uploaded file.
keyColumnsStringyes   Key columns to use to update the file. This only allowed when `updateMode` is set to `update`, in which case it is mandatory. If new rows match existing rows in these columns, the existing row will be updated. If not, new rows will be appended.
keyColumnsIgnoreCaseBoolean    Whether to match key columns case insensitively or not. Should only be set when `updateMode` is `Update`, in which case it is mandatory.
labelsStringyes   Labels to categorize the action.
nameStringyes Long-Term The name of the action.
updateModeUpdateMode    The mode for the file update.
viewNameStringyes Long-Term The name of the view of the action.

Returned Values

The mutation returns an UploadFileAction! object representing the newly created action. The returned object includes the action ID, name, associated file details, update mode, key columns, creation and modification timestamps, and the user who last modified the action.

Table: UploadFileAction Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
allowedActions[AssetAction]yes Short-Term A list of allowed asset actions. See AssetAction . This is a preview and subject to change.
createdInfoAssetCommitMetadata  Long-Term Metadata related to the creation of the action. See AssetCommitMetadata.
displayNamestringyes Long-Term The display name of the action.
fileNamestringyes Long-Term The name of the uploaded file.
idstringyes Long-Term The unique identifier of the action.
isAllowedToRunbooleanyes Long-Term False if disabled because of a security policy.
labels[string]  Preview Labels attached to the action.
modifiedInfoAssetCommitMetadata  Long-Term Metadata related to the latest modification of the action. See AssetCommitMetadata.
namestringyes Long-Term The name of the action.
packagePackageInstallation  Long-Term The package, if any, of which the action is part. See PackageInstallation.
packageIdVersionedPackageSpecifier  Long-Term The unique identifier of the package. VersionedPackageSpecifier is a scalar.
requiresOrganizationOwnedQueriesPermissionToEditbooleanyes Long-Term True if this action is used by triggers, where the query is run by the organization. If true, the OrganizationOwnedQueries permission is required to edit.
resourcestringyes Short-Term The resource identifier for this action.
yamlTemplateYAMLyes Long-Term A template that can be used to recreate the action. YAML is a scalar.