Skip to content

API Reference

GET /v1/platform/properties

Get punchplatform.properties file.

Response

Status

Status Code Reason
200 Successful operation

Example request

curl --location --request GET 'http://localhost:4242/v1/platform/properties'

GET /v1/platform/tenant

Get tenant used by the gateway.

Response

Body

Field Description
tenant Tenant set in Gateway settings

Status

Status Code Reason
200 Successful operation

Example request

curl --location --request GET 'http://localhost:4242/v1/platform/tenant'

Example response

{
    "tenant": "mytenant"
}

POST /v1/puncher/{operator}

Execute a punchlet which using the given operator

Request

Path variable

Field Description
operator Operator to use ("grok", "dissect" or "punchlet")

Form

Field Description
input File containing log samples
pattern File contaning the pattern

Response

Status

Status Code Reason
200 successful operation
500 Invalid input or pattern

Example request

curl --location --request POST 'http://localhost:4242/v1/puncher/dissect' \
--form 'input=@/my_dissect_folder/input' \
--form 'pattern=@/my_dissect_folder/pattern'

DELETE /v1/{tenant}/archives

Delete all existing archives for a tenant

Request

Path variables

Field Description
tenant Tenant name

Response

Status

Status Code Reason
200 successful operation

Example request

curl --location --request DELETE 'http://localhost:4242/v1/mytenant/archives'

GET /v1/{tenant}/archives/{id}

Download an archive generated by a punchline

Request

Path variables

Field Description
tenant Tenant name
id Archive id to download

Response

HTTP Status

Status Code Reason
200 Successful download
404 Archive not found

Example request

curl --location --request GET 'http://localhost:4242/v1/mytenant/archives/my_archive'

DELETE /v1/{tenant}/archives/{id}

Delete an archive

Request

Path variables

Field Description
tenant Tenant name
id Archive id to delete

Response

Status

Status Code Reason
200 Successful download
404 Archive not found

Example request

curl --location --request DELETE 'http://localhost:4242/v1/mytenant/archives/my_archive'

GET /v1/{tenant}/channels

Get all tenant channels status

Request

Path variables

Field Description
tenant Tenant name

Response

Body

Field Description
children Array of valid channels
children[].name Name of the channel
children[].status Status of the channel
errors Array of invalid channels
errors[].name Name of the channel
errors[].status Status of the channel

Status

Status Code Reason
200 successful operation

Example request

curl --location --request GET 'http://localhost:4242/v1/mytenant/channels'

Example response

{
    "children": [
        {
            "name": "logstash",
            "status": "STOPPED"
        },
        {
            "name": "admin",
            "status": "STOPPED"
        },
        {
            "name": "apache_httpd",
            "status": "STOPPED"
        }
    ],
    "errors": []
}

GET /v1/{tenant}/channels/{channel}

Get status of a specific channel

Request

Path variables

Field Description
tenant Tenant name
channel Channel name

Response

Body

Field Description
status Channel status
jobs List of jobs of the channel
jobs[].cluster Job cluster name
jobs[].name Job name
jobs[].runtimeId Job related path
jobs[].status Job status

Status

Status Code Reason
200 successful operation
404 Channel not found

Example request

curl --location --request GET 'http://localhost:4242/v1/mytenant/channels/admin'

Example response

{
    "status": "ACTIVE",
    "jobs": [
        {
            "cluster": "common",
            "name": "admin/common/elasticsearch-housekeeping",
            "runtimeId": "punchplatform/mytenant/channels/admin/elasticsearch-housekeeping",
            "status": "ACTIVE"
        },
        {
            "cluster": "common",
            "name": "admin/common/archives-housekeeping",
            "runtimeId": "punchplatform/mytenant/channels/admin/archives-housekeeping",
            "status": "ACTIVE"
        },
        {
            "cluster": "common",
            "name": "admin/common/channels-monitoring",
            "runtimeId": "punchplatform/mytenant/channels/admin/channels-monitoring",
            "status": "ACTIVE"        
        }
    ]
}

POST /v1/{tenant}/channels/{channel}/{action}

Request

Path variables

Field Description
tenant Tenant name
channel Channel name
action Action to operate on the channel ("start" or "stop")

Response

Status

Status Code Reason
201 Successful action
404 Channel doesn't exist

Example request

curl --location --request POST 'http://localhost:4242/v1/mytenant/channels/admin/start'

GET /v1/{tenant}/conf

List all tenant related files and directories in configuration folder

Request

Path variables

Field Description
tenant Tenant name

Response

Body

Field Description
PATH.parent Parent folder name
PATH.path Relative path
PATH.size Folder/File size
PATH.isFile true if PATH is a file, else false
PATH.canRead Able to read file/folder content
PATH.children Map of subfile / subfolder content

Status

Status Code Reason
200 successful operation

Example request

curl --location --request GET 'http://localhost:4242/v1/mytenant/conf'

Example response

{
    "tenants": {
        "parent": "/conf",
        "path": "/tenants",
        "size": 4096,
        "isFile": false,
        "canRead": true,
        "children": {
            "mytenant": {
                "parent": "/conf/tenants",
                "path": "/tenants/mytenant",
                "size": 4096,
                "isFile": false,
                "canRead": true,
                "children": {
                    "test_file": {
                        "parent": "/conf/tenants/mytenant",
                        "path": "/tenants/mytenant/test_file",
                        "size": 162,
                        "isFile": true,
                        "canRead": true,
                        "children": {}
                    }
                }
            }
        }
    }
}

GET /v1/{tenant}/conf/{path}

Get a file from configuration folder

Request

Path variables

Field Description
tenant Tenant name
path Path to file

Response

Status

Status Code Reason
200 successful operation
400 "path" given is a directory
404 File not found

Example request

curl --location --request GET \
'http://localhost:4242/v1/mytenant/conf/tenants/mytenant/test_file'

POST /v1/{tenant}/extraction

Create extraction

Request

Path variables

Field Description
tenant Tenant name

Body

Field Description
description Extraction description
format Extraction format ("csv", "json")
index Elasticsearch index
fields List of fields to extract
fields[].name Field name
fields[].type Field type
filters Elastic filters to apply
tenant Tenant name
### Response
#### Status
Status Code Reason
200 successful operation

Example request

curl --location --request POST 'http://localhost:4242/v1/mytenant/extraction' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--header 'Content-Type: application/json' \
--data-raw \
'{
     "description": "log-extraction",
     "format": "csv",
     "index": "platform-logs-*",
     "fields": [
         {
             "name": "@timestamp",
             "type": "date"
         },
         {
             "name": "content.message",
             "type": "string"
         }
     ],
     "filters": {},
     "tenant": "mytenant"
 }'

GET /v1/{tenant}/punchline

List punchlines saved.

Request

Path variables

Field Description
tenant Tenant name

Response

Body

Field Description
[].id Punchline ID
[].punchline Punchline file content
[].version Punchline version
[].platformId Punchline platform ID
[].@timestamp Punchline save timestamp

Status

Status Code Reason
200 successful operation

Example request

curl --location --request GET 'http://localhost:4242/v1/mytenant/punchline'

Example response

[
    {
        "id": "BtDHgnEByFYZVYsBXB30",
        "punchline": {
            "runtime_id": "BtDHgnEByFYZVYsBXB30",
            "metrics": {
                "reporters": [
                    {
                        "http_hosts": [
                            {
                                "port": 9200,
                                "host": "localhost"
                            }
                        ],
                        "type": "elasticsearch",
                        "index_name": "mytenant-metrics"
                    }
                ]
            },
            "job": [
                {
                    "settings": {
                        "input_data": [
                            {
                                "name": "phil",
                                "musician": false,
                                "age": 21,
                                "friends": [
                                    "alice"
                                ]
                            },
                            {
                                "name": "alice",
                                "musician": true,
                                "age": 23,
                                "friends": [
                                    "dimi"
                                ]
                            },
                            {
                                "name": "dimi",
                                "musician": true,
                                "age": 53,
                                "friends": [
                                    "phil",
                                    "alice"
                                ]
                            }
                        ]
                    },
                    "component": "input",
                    "publish": [
                        {
                            "stream": "data"
                        }
                    ],
                    "description": "The batch_input node simply generates some data.\nYou simply write your data inline, it convert it as Dataset<Row>",
                    "type": "dataset_generator"
                },
                {
                    "settings": {
                        "truncate": false
                    },
                    "component": "show",
                    "subscribe": [
                        {
                            "component": "input",
                            "stream": "data"
                        }
                    ],
                    "type": "show"
                }
            ],
            "type": "spark",
            "tenant": "mytenant"
        },
        "version": -1,
        "platformId": "my-unique-platform-id",
        "@timestamp": "2020-04-12T11:37:15.766Z"
    }
]

GET /v1/{tenant}/punchline/executions

Get all tenant related punchlines executions.

Request

Path variables

Field Description
tenant Tenant name

Response

Body

Field Description
id Execution ID
timestamp Last event timestamp
duration Execution duration
tenant Tenant name
event Execution last event

Status

Status Code Reason
200 successful operation

Example request

curl --location --request GET \ 
'http://localhost:4242/v1/mytenant/punchline/executions'

Example response

[
    {
        "id": "wc2Yh3EBnOslsCeb6UAg-1587117889508",
        "timestamp": "2020-04-17T10:04:55.320Z",
        "duration": 229,
        "tenant": "mytenant",
        "event": "spark.application.start"
    }
]

GET /v1/{tenant}/punchline/executions/{id}/events

List all events of a specific execution.

Request

Path variables

Field Description
tenant Tenant name
id Execution ID

Response

Body

Field Description
[].timestamp Event timestamp
[].tenant Tenant name
[].event Execution event

Status

Status Code Reason
200 successful operation
404 Execution not found

Example request

curl --location --request GET \
'http://localhost:4242/v1/mytenant/punchline/executions/wc2Yh3EBnOslsCeb6UAg-1587117889508/events'

Example response

[
    {
        "timestamp": "2020-04-17T10:04:58.247Z",
        "tenant": "mytenant",
        "event": "spark.application.end"
    },
    {
        "timestamp": "2020-04-17T10:04:58.241Z",
        "tenant": "mytenant",
        "event": "spark.application.end"
    },
    {
        "timestamp": "2020-04-17T10:04:58.217Z",
        "tenant": "mytenant",
        "event": "spark.application.end"
    },
    ... 
]

GET /v1/{tenant}/punchline/executions/{id}/output

Get output of a specific execution.

Request

Path variables

Field Description
tenant Tenant name
id Execution ID

Response

Status

Status Code Reason
200 successful operation
404 Execution not found

Example request

curl --location --request GET \
'http://localhost:4242/v1/mytenant/punchline/executions/wc2Yh3EBnOslsCeb6UAg-1587117889508/output'

GET /v1/{tenant}/punchline/executions/{id}

Get executions for a specific punchline.

Request

Path variables

Field Description
tenant Tenant name
id Punchline ID

Response

Body

Field Description
[].id Execution ID
[].timestamp Last event timestamp
[].duration Execution duration
[].tenant Tenant name
[].event Execution last event

Status

Status Code Reason
200 successful operation
404 Punchline not found

Example request

curl --location --request GET 'http://localhost:4242/v1/mytenant/punchline/executions/wc2Yh3EBnOslsCeb6UAg'

Example Response

[
    {
        "id": "wc2Yh3EBnOslsCeb6UAg-1587117889508",
        "timestamp": "2020-04-17T10:04:58.247Z",
        "duration": 3156,
        "tenant": "mytenant",
        "event": "spark.application.end"
    }
]

POST /v1/{tenant}/punchline/save

Save a punchline

Request

Path variables

Field Description
tenant Tenant name

Form

Field Description
file Punchline file

Response

Status

Status Code Reason
200 successful operation

Example request

curl --location --request POST 'http://localhost:4242/v1/mytenant/punchline/save' \
--form 'file=@/data/punchlines/dataset_generator.pml'

GET /v1/{tenant}/punchline/scan

Get all nodes available for punchline. Response stored in cache for 1 hour to avoid request timeout.

Request

Path variables

Field Description
tenant Tenant name

Response

Status

Status Code Reason
200 successful operation

Example request

curl --location --request GET 'http://localhost:4242/v1/mytenant/punchline/scan'

DELETE /v1/{tenant}/punchline/scan/reset

Force the reset of the scanner cache

Request

Path variables

Field Description
tenant Tenant name

Response

Status

Status Code Reason
200 successful operation

Example request

curl --location --request GET 'http://localhost:4242/v1/mytenant/punchline/scan'

GET /v1/{tenant}/punchline/{id}

Get punchline.

Request

Path variables

Field Description
tenant Tenant name
id Punchline id

Response

Body

Field Description
index Elasticsearch index where punchline is stored
id Punchline id
source Punchline file content

Status

Status Code Reason
200 successful operation
404 Punchline not found

Example request

curl --location --request GET 'http://localhost:4242/v1/mytenant/punchline/wc2Yh3EBnOslsCeb6UAg'

Example response

{
    "index": "mytenant-applications",
    "id": "wc2Yh3EBnOslsCeb6UAg",
    "source": {
        "@timestamp": "2020-04-17T10:04:37.537Z",
        "platform_id": "my-unique-platform-id",
        "dag": "{\"runtime_id\":\"wc2Yh3EBnOslsCeb6UAg\",\"metrics\":{\"reporters\":[{\"http_hosts\":[{\"port\":9200,\"host\":\"localhost\"}],\"type\":\"elasticsearch\",\"index_name\":\"mytenant-metrics\"}]},\"job\":[{\"settings\":{\"input_data\":[{\"name\":\"phil\",\"musician\":false,\"age\":21,\"friends\":[\"alice\"]},{\"name\":\"alice\",\"musician\":true,\"age\":23,\"friends\":[\"dimi\"]},{\"name\":\"dimi\",\"musician\":true,\"age\":53,\"friends\":[\"phil\",\"alice\"]}]},\"component\":\"input\",\"publish\":[{\"stream\":\"data\"}],\"description\":\"The batch_input node simply generates some data.\\nYou simply write your data inline, it convert it as Dataset<Row>\",\"type\":\"dataset_generator\"},{\"settings\":{\"truncate\":false},\"component\":\"show\",\"subscribe\":[{\"component\":\"input\",\"stream\":\"data\"}],\"type\":\"show\"}],\"type\":\"spark\",\"tenant\":\"mytenant\"}",
        "tenant": "mytenant"
    }
}

POST /v1/{tenant}/punchline/{id}

Execute a saved punchline

Request

Path variables

Field Description
tenant Tenant name
id Punchline id

Response

Body

Field Description
id Execution generated id

Status

Status Code Reason
200 successful operation
404 Punchline not found

Example request

curl --location --request POST 'http://localhost:4242/v1/mytenant/punchline/wc2Yh3EBnOslsCeb6UAg'

Example response

{
    "id": "wc2Yh3EBnOslsCeb6UAg-1587117889508"
}

DELETE /v1/{tenant}/punchline/{id}

Delete a saved punchline.

Request

Path variables

Field Description
tenant Tenant name
id Punchline id

Response

Status

Status Code Reason
200 successful operation
404 Punchline not found

Example request

curl --location --request DELETE 'http://localhost:4242/v1/mytenant/punchline/wc2Yh3EBnOslsCeb6UAg'