{"id":21001096,"url":"https://github.com/parseablehq/parseable-sdk-go","last_synced_at":"2025-12-29T23:23:37.330Z","repository":{"id":226858679,"uuid":"768929760","full_name":"parseablehq/parseable-sdk-go","owner":"parseablehq","description":"Golang SDK for Parseable","archived":false,"fork":false,"pushed_at":"2024-03-10T08:27:52.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T09:46:24.371Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.parseable.com/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parseablehq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["parseable","operator"]}},"created_at":"2024-03-08T01:52:13.000Z","updated_at":"2024-03-10T06:44:33.000Z","dependencies_parsed_at":"2024-06-21T12:59:37.458Z","dependency_job_id":"5594fc8b-4afa-463a-b0e7-f32accb638f5","html_url":"https://github.com/parseablehq/parseable-sdk-go","commit_stats":null,"previous_names":["parseablehq/parseable-sdk-go"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parseablehq%2Fparseable-sdk-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parseablehq%2Fparseable-sdk-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parseablehq%2Fparseable-sdk-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parseablehq%2Fparseable-sdk-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parseablehq","download_url":"https://codeload.github.com/parseablehq/parseable-sdk-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243418665,"owners_count":20287798,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T08:13:39.134Z","updated_at":"2025-12-29T23:23:37.289Z","avatar_url":"https://github.com/parseablehq.png","language":"Go","funding_links":["https://github.com/sponsors/parseable","https://github.com/sponsors/operator"],"categories":[],"sub_categories":[],"readme":"\u003ch2 align=\"center\"\u003e\n    \u003cpicture\u003e\n      \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/parseablehq/.github/main/images/logo-dark.png\"\u003e\n      \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/parseablehq/.github/main/images/logo.svg\"\u003e\n      \u003cimg alt=\"Parseable Logo\" src=\"https://raw.githubusercontent.com/parseablehq/.github/main/images/logo.svg\"\u003e\n    \u003c/picture\u003e\n    \u003cbr\u003e\n    Parseable Golang SDK\n\u003c/h2\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![Docker Pulls](https://img.shields.io/docker/pulls/parseable/parseable?logo=docker\u0026label=Docker%20Pulls)](https://hub.docker.com/r/parseable/parseable)\n[![Slack](https://img.shields.io/badge/slack-brightgreen.svg?logo=slack\u0026label=Community\u0026style=flat\u0026color=%2373DC8C\u0026)](https://launchpass.com/parseable)\n[![Docs](https://img.shields.io/badge/stable%20docs-parseable.io%2Fdocs-brightgreen?style=flat\u0026color=%2373DC8C\u0026label=Docs)](https://www.parseable.io/docs)\n[![Build](https://img.shields.io/github/checks-status/parseablehq/parseable/main?style=flat\u0026color=%2373DC8C\u0026label=Checks)](https://github.com/parseablehq/parseable/actions)\n\n\u003c/div\u003e\n\nParseable is a lightweight, cloud native log observability engine. Written in Rust, Parseable is built for high ingestion rates and low resource consumption. It is compatible with all major log agents and can be configured to collect logs from any source. Read more in [Parseable docs](https://www.parseable.io/docs).\n\n## Parseable Golang SDK\n\nThis golang sdk can be embeeded in applications to send logs directly to parseable.\n\n## Installation\n\nThe Parseable  golang sdk can be installed using go:\n\n```bash\ngo get github.com/parseablehq/parseable-sdk-go/parseable\n```\n## Example Usage\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"os\"\n\t\"time\"\n\n\t\"github.com/parseablehq/parseable-sdk-go/parseable\"\n)\n\n// Sample log data in JSON format\nvar log = `[\n\t{\n\t\t\"message\": \"tenants creation failed\",\n\t\t\"type\": \"error\",\n\t\t\"reason\": \"TenantsCreationFailed\",\n\t\t\"object\": \"baaz/tenants\"\n\t}\n]`\n\n// Default duration for the query\nvar duration = \"10h\"\n\n// QueryBuilder represents a query builder for fetching logs\ntype QueryBuilder struct {\n\tQuery     string    `json:\"query\"`     // Query string\n\tStartTime time.Time `json:\"startTime\"` // Start time for the query\n\tEndTime   time.Time `json:\"endTime\"`   // End time for the query\n}\n\nfunc main() {\n\t// Set environment variables for Parseable SDK\n\tos.Setenv(\"PARSEABLE_URL\", \"http://localhost:9000\")\n\tos.Setenv(\"PARSEABLE_USERNAME\", \"admin\")\n\tos.Setenv(\"PARSEABLE_PASSWORD\", \"admin\")\n\n\t// Define stream name\n\tstream := \"mystream\"\n\n\t// Create a new stream\n\tstreamBuilder := parseable.NewStreamBuilder(\n\t\tstream,\n\t\tnil, // No initial data\n\t\tnil, // No metadata\n\t\tnil, // No tags\n\t)\n\n\tresp, err := streamBuilder.CreateStream()\n\tif err != nil \u0026\u0026 resp == 400 {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\t// Labels associated with the log data\n\tlabels := map[string]string{\n\t\t\"type\": \"json\",\n\t}\n\n\t// Tags associated with the log data\n\ttags := map[string]string{\n\t\t\"app\": \"myapp\",\n\t}\n\n\t// Create a new stream with log data, labels, and tags\n\tlogStream := parseable.NewStreamBuilder(\n\t\tstream,\n\t\t[]byte(log), // Log data\n\t\tlabels,      // Labels\n\t\ttags,        // Tags\n\t)\n\n\t// Insert logs into the stream\n\t_, err = logStream.InsertLogs()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\t// Parse duration string to time.Duration\n\tduration, err := time.ParseDuration(\"-\" + duration)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\t// Get current time\n\tcurrentTime := time.Now()\n\n\t// Calculate start time by subtracting duration from current time\n\tstartTime := currentTime.Add(duration)\n\n\t// Construct a new query with stream name and start/end times\n\tnewQuery := QueryBuilder{\n\t\tQuery:     fmt.Sprintf(\"select * from %s\", stream),\n\t\tStartTime: startTime,\n\t\tEndTime:   currentTime,\n\t}\n\n\t// Marshal query to JSON format\n\tbody, err := json.Marshal(newQuery)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\t// Create a new query builder with the query body\n\tqueryBuilder := parseable.NewQueryBuilder(string(body))\n\n\t// Query logs using the specified criteria\n\tresp, err := queryBuilder.QueryStream()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\t// Print query response\n\tfmt.Println(resp)\n}\n\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparseablehq%2Fparseable-sdk-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparseablehq%2Fparseable-sdk-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparseablehq%2Fparseable-sdk-go/lists"}