Docker Quick Start
This page shows you how to quickly get started with Parseable. You'll start Parseable server in local-store
mode, and then insert and read some sample data using SQL.
Start Parseable
Parseable Docker is the fastest way to get started. If you don't have Docker installed already, refer this doc to install Docker on your machine.
docker run -p 8000:8000 \
-v /tmp/parseable/data:/parseable/data \
-v /tmp/parseable/staging:/parseable/staging \
-e P_FS_DIR=/parseable/data \
-e P_STAGING_DIR=/parseable/staging \
parseable/parseable:latest \
parseable local-store
Parseable listens on the port 8000. You can access Parseable UI at http://localhost:8000. Default credentials are admin
and admin
.
Create a log stream
Parseable uses log streams to organize log data. You can create a log stream with a PUT call to log stream endpoint. For example, below command creates a log stream called demo
(note the demo
in the URL).
curl --location --request PUT \
'http://localhost:8000/api/v1/logstream/demo' \
--header 'Authorization: Basic YWRtaW46YWRtaW4='
Ingest log data
You can post log data to the log stream demo
using POST call to log stream endpoint.
Add Metadata and Tags
Metadata are primarily used for defining extra information for a log event while tags are used for organizing events. For example, severity=warn
, severity=error
are good examples of metadata, while environment=prod
, environment=dev
are good examples of tags.
To add metadata and tags to a log event, add X-P-META-
and X-P-TAGS-
headers to the request. For example, below command adds meta1=value1
and tag1=value1
to the log event.
Below command posts a sample log data to the log stream demo
.
curl --location --request POST \
'http://localhost:8000/api/v1/logstream/demo' \
--header 'X-P-META-meta1: value1' \
--header 'X-P-TAGS-tag1: value1' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"id": "434a5f5e-2f5f-11ed-a261-0242ac120002",
"datetime": "2023-01-05T07:20:50.52Z",
"host": "153.10.110.81",
"user-identifier": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) Firefox/64.0",
"method": "PUT",
"status": 500,
"referrer": "http://www.google.com/"
}
]'
Query log data
You can query the data via Parseable Console or API. To query the data via UI, login at http://localhost:8000 and select the log stream demo
and correct time stamp.
To query the data via API, use the following command. Before using the command make sure to update the startTime
and endTime
fields with correct time in UTC.
curl --location --request POST 'http://localhost:8000/api/v1/query' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--header 'Content-Type: application/json' \
--data-raw '{
"query": "select * from demo",
"startTime": "2022-09-10T08:20:00+00:00",
"endTime": "2022-09-10T08:20:31+00:00"
}'
For complete Parseable API documentation, refer to Parseable API Ref Docs.