Skip to content
This repository has been archived by the owner on Nov 26, 2020. It is now read-only.

Example: Custom Log Search

Farshid Tavakolizadeh edited this page Feb 25, 2019 · 1 revision

Search

The search uses Elasticsearch's search body format: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html

GET /logs/search

Request:

{
    "query": {
        "bool": {
            "must": [
                {
                    "match": {
                        "target": "my-laptop"
                    }
                },
                {
                    "match": {
                        "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c"
                    }
                }
                
            ]
        }
    },
    "sort": {
        "time": "asc"
    },
    "from": 0,
    "size": 100
}

Response:

{
    "total": 84,
    "items": [
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "STAGE-START",
            "time": 1550760204391,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "compressed to 571 bytes",
            "time": 1550760204410,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760204424,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760205436,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "received package sized 1025981 bytes",
            "time": 1550760206077,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "STAGE-START",
            "time": 1550760206113,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "compressed to 1026008 bytes",
            "time": 1550760206216,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760206223,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760207241,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760215456,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760216474,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760217260,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760218276,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760226494,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760227513,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760228299,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760229319,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760237538,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760238553,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760239341,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760240364,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760248581,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760249599,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760250388,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760251403,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760259622,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760260647,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760261422,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760262441,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760270673,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760271686,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760272465,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760273481,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760281710,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760282722,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760283496,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760284515,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760292745,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760293768,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760294536,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760295559,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760303788,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760304798,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760305584,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760306604,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760314824,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760315839,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760316624,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760317643,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760325864,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760326882,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760327659,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760328675,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760336919,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760337940,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760338710,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760339732,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760347966,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760348979,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760349756,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760350784,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760359001,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760360016,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760360820,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760361842,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760370041,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760371052,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760371858,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760372878,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760381074,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760382086,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760382911,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760383926,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760392107,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760393119,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent announcement",
            "time": 1550760393949,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "transfer",
            "command": "$manager",
            "output": "sent task",
            "time": 1550760394969,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "run",
            "command": "$agent",
            "output": "STAGE-START",
            "time": 1550760659469,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "run",
            "command": "./count_to_three",
            "output": "EXEC-START",
            "time": 1550760659469,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "run",
            "command": "./count_to_three",
            "output": "hello 1",
            "time": 1550760659484,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "run",
            "command": "./count_to_three",
            "output": "hello 2",
            "time": 1550760660485,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "run",
            "command": "./count_to_three",
            "output": "hello 3",
            "time": 1550760661487,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "run",
            "command": "./count_to_three",
            "output": "EXEC-END",
            "time": 1550760662490,
            "target": "my-laptop"
        },
        {
            "task": "0b796aac-30f7-47b5-ad13-0bfe8367be5c",
            "stage": "run",
            "command": "$agent",
            "output": "STAGE-END",
            "time": 1550760662491,
            "target": "my-laptop"
        }
    ]
}