Downloading Installers from the Command-line

A list of available installers can be obtained from LogScale by running a GraphQL query against your LogScale instance:

Note

You must specify the url of your LogScale in $YOUR_LOGSCALE_URL

Raw
graphql
{
  logCollectorInstallers{
    url
    architecture
    name
    type
    version
    configExample
  }
}
Mac OS or Linux (curl)
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $INGEST_TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "{
  logCollectorInstallers{
    url
    architecture
    name
    type
    version
    configExample
  }
}"
}
EOF
Mac OS or Linux (curl) One-line
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $INGEST_TOKEN" \
    -H "Content-Type: application/json"
Windows Cmd and curl
cmd
curl -v -X POST $YOUR_LOGSCALE_URL/graphql ^
    -H "Authorization: Bearer $INGEST_TOKEN" ^
    -H "Content-Type: application/json" ^
    -d @'{"query" : "{ ^
  logCollectorInstallers{ ^
    url ^
    architecture ^
    name ^
    type ^
    version ^
    configExample ^
  } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $INGEST_TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "{
  logCollectorInstallers{
    url
    architecture
    name
    type
    version
    configExample
  }
}"
}'
"$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;
my $TOKEN = "TOKEN";
my $uri = '$YOUR_LOGSCALE_URL/graphql';
my $json = '{"query" : "{
  logCollectorInstallers{
    url
    architecture
    name
    type
    version
    configExample
  }
}"
}';
my $req = HTTP::Request->new("POST", $uri );
$req->header("Authorization" => "Bearer $INGEST_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" : "{
  logCollectorInstallers{
    url
    architecture
    name
    type
    version
    configExample
  }
}"
}'''

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

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

const data = JSON.stringify(
    {"query" : "{
  logCollectorInstallers{
    url
    architecture
    name
    type
    version
    configExample
  }
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL/graphql',
  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();

The query will return a JSON structure with a list of the available installers:

json
{
   "data" : {
      "logCollectorInstallers" : [
         {
            "architecture" : "amd64",
            "configExample" : "dataDirectory: C:\\ProgramData\\LogScale Collector\nsources:\n  windows_events:\n    type: wineventlog\n    channels:\n      - name: Application\n      - name: Security\n      - name: System\n    sink: humio\nsinks:\n  humio:\n    type: humio\n    token: <ingest-token>\n    proxy: none\n    url: $YOUR_LOGSCALE_URL\n",
            "name" : "logscale-collector_1.2.1_windows_amd64.msi",
            "type" : "msi",
            "url" : "$YOUR_LOGSCALE_URL/api/v1/log-collector/download/logscale-collector_1.2.1_windows_amd64.msi",
            "version" : "1.2.1"
         },
         {
            "architecture" : "universal",
            "configExample" : null,
            "name" : "logscale-collector_1.2.1_macOS_universal.pkg",
            "type" : "pkg",
            "url" : "$YOUR_LOGSCALE_URL/api/v1/log-collector/download/logscale-collector_1.2.1_macOS_universal.pkg",
            "version" : "1.2.1"
         },
         {
            "architecture" : "amd64",
            "configExample" : "dataDirectory: /var/lib/logscale-collector\nsources:\n  var_log:\n    type: file\n    include: /var/log/*\n    sink: humio\nsinks:\n  humio:\n    type: humio\n    token: <ingest-token>\n    url: $YOUR_LOGSCALE_URL\n",
            "name" : "logscale-collector_1.2.1_linux_amd64.deb",
            "type" : "deb",
            "url" : "$YOUR_LOGSCALE_URL/api/v1/log-collector/download/logscale-collector_1.2.1_linux_amd64.deb",
            "version" : "1.2.1"
         },
         {
            "architecture" : "amd64",
            "configExample" : "dataDirectory: /var/lib/logscale-collector\nsources:\n  var_log:\n    type: file\n    include: /var/log/*\n    sink: humio\nsinks:\n  humio:\n    type: humio\n    token: <ingest-token>\n    url: $YOUR_LOGSCALE_URL\n",
            "name" : "logscale-collector_1.2.1_linux_amd64.rpm",
            "type" : "rpm",
            "url" : "$YOUR_LOGSCALE_URL/api/v1/log-collector/download/logscale-collector_1.2.1_linux_amd64.rpm",
            "version" : "1.2.1"
         },
         {
            "architecture" : "arm64",
            "configExample" : "dataDirectory: /var/lib/logscale-collector\nsources:\n  var_log:\n    type: file\n    include: /var/log/*\n    sink: humio\nsinks:\n  humio:\n    type: humio\n    token: <ingest-token>\n    url: $YOUR_LOGSCALE_URL\n",
            "name" : "logscale-collector_1.2.1_linux_arm64.deb",
            "type" : "deb",
            "url" : "$YOUR_LOGSCALE_URL/api/v1/log-collector/download/logscale-collector_1.2.1_linux_arm64.deb",
            "version" : "1.2.1"
         },
         {
            "architecture" : "arm64",
            "configExample" : "dataDirectory: /var/lib/logscale-collector\nsources:\n  var_log:\n    type: file\n    include: /var/log/*\n    sink: humio\nsinks:\n  humio:\n    type: humio\n    token: <ingest-token>\n    url: $YOUR_LOGSCALE_URL\n",
            "name" : "logscale-collector_1.2.1_linux_arm64.rpm",
            "type" : "rpm",
            "url" : "$YOUR_LOGSCALE_URL/api/v1/log-collector/download/logscale-collector_1.2.1_linux_arm64.rpm",
            "version" : "1.2.1"
         }
      ]
   }
}

The key elements from each entry are the type, which defines the installer type (for example msi for Windows, or deb for Debian package), and the url which contains the URL to use for the download.

Once the correct URL has been identified, use a tool such as wget to download the file:

shell
$ wget --method GET --header 'Authorization: Bearer $INGEST_TOKEN' $YOUR_LOGSCALE_URL/api/v1/log-collector/download/logscale-collector_1.2.1_linux_arm64.rpm

Or curl

shell
$ curl -X GET -H "Authorization: Bearer $INGEST_TOKEN" \
    $YOUR_LOGSCALE_URL/api/v1/log-collector/download/logscale-collector_1.2.1_linux_arm64.rpm

Once you have the installer you can follow the corresponding installation instructions for each platform.