{"id":19826249,"url":"https://github.com/aternosorg/mclogs-java","last_synced_at":"2026-01-30T19:00:51.674Z","repository":{"id":48057970,"uuid":"334462814","full_name":"aternosorg/mclogs-java","owner":"aternosorg","description":"Java library for mclogs","archived":false,"fork":false,"pushed_at":"2026-01-28T12:22:15.000Z","size":210,"stargazers_count":11,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2026-01-29T04:45:11.216Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aternosorg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2021-01-30T16:48:00.000Z","updated_at":"2026-01-28T12:22:19.000Z","dependencies_parsed_at":"2025-08-10T11:30:26.954Z","dependency_job_id":null,"html_url":"https://github.com/aternosorg/mclogs-java","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/aternosorg/mclogs-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fmclogs-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fmclogs-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fmclogs-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fmclogs-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aternosorg","download_url":"https://codeload.github.com/aternosorg/mclogs-java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fmclogs-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28917454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T16:37:38.804Z","status":"ssl_error","status_checked_at":"2026-01-30T16:37:37.878Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-12T11:09:52.645Z","updated_at":"2026-01-30T19:00:51.644Z","avatar_url":"https://github.com/aternosorg.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mclogs-java\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/aternosorg/mclogs-java/build.yml)\n![Maven Central Version](https://img.shields.io/maven-central/v/gs.mclo/api)\n![Requires Java 11](https://img.shields.io/badge/Requires-Java_11-orange)\n\nA java library used to list and share log files to the [mclo.gs](https://mclo.gs) API.\nThis library is used in the [mclogs plugin and mods](https://github.com/aternosorg/mclogs-integration).\n\n### Features\n- Full API coverage including:\n  - Uploading log files\n  - Analysing log files without uploading them\n  - Fetching log contents and information\n  - Attaching metadata to log uploads\n  - Deleting logs\n  - Getting log insights\n  - Fetching storage limits\n- Remove IPv4 and IPv6 addresses before uploading the log\n- Automatically trim logs and shorten them to the instance's limits before uploading\n- Compresses uploaded logs with GZIP to reduce upload size\n\n### Usage\nThis project is available from Maven Central, so you just need to add the dependency to your project:\n\n#### Gradle\n```gradle\ndependencies {\n    implementation 'gs.mclo:api:6.0.0'\n}\n```\n\n#### Maven\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003egs.mclo\u003c/groupId\u003e\n  \u003cartifactId\u003eapi\u003c/artifactId\u003e\n  \u003cversion\u003e6.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Upload a log file\n\nObtaining a log file:\n```java\n// by path\nvar log = new Log(Paths.get(\"./logs/latest.log\"));\n// or by raw content\nlog = new Log(\"example content\");\n```\n\nCreating a client:\n```java\n// Create a client with a project name and version\nvar client = new MclogsClient(\"mclogs-java-example\", \"1.0.0\");\n// optionally with a minecraft version\nclient = new MclogsClient(\"mclogs-java-example\", \"1.0.0\", \"1.12.2\");\n// or with a custom user agent\nclient = new MclogsClient(\"mclogs-java-example/1.0.0\");\n```\nProject names are used as the `source` field when uploading logs unless they're already set in the `Log` object passed\nto the API client.\n\nSharing the log file:\n```java\n// share the log file\nCompletableFuture\u003cUploadLogResponse\u003e future = client.uploadLog(log);\nUploadLogResponse response = future.get();\nSystem.out.println(response.getUrl());\n```\n\nThere are also shortcuts for posting raw content or a path:\n```java\n// share a log file by path\nCompletableFuture\u003cUploadLogResponse\u003e future = client.uploadLog(Paths.get(\"./logs/latest.log\"));\n// share a log file by raw content\nfuture = client.uploadLog(\"example content\");\n```\n\nIf you want to provide additional metadata, you can set it in the `Log` object:\n```java\nlog.setSource(\"mclogs-client-example\")\n    .addMetadata(new Metadata\u003c\u003e(\"example-key\", \"example-value\", \"Example Label\", true))\n    .addMetadata(new Metadata\u003c\u003e(\"other-example\", 5548));\n```\n\n### Get log information\n```java\nvar logInfo = client.getLog(\"HpAwPry\").get();\nSystem.out.println(\"Log source: \" + logInfo.getSource());\nSystem.out.println(\"Uploaded at: \" + logInfo.getCreated());\n```\n\nThis method also allows you to fetch the content of the log in three different variants:\n- raw: The raw log content as a string\n- parsed: The parsed log as a list of entries with additional information\n- insights: The log insights generated by the mclogs analysis engine\n\nYou can request the variants you want by using the `LogField` enum:\n```java\nvar logInfo = client.getLog(\"HpAwPry\", LogField.RAW, LogField.PARSED, LogField.INSIGHTS).get();\nSystem.out.println(logInfo.getContent().getRaw());\nSystem.out.println(\"Parsed entries: \" + logInfo.getContent().getParsed().length);\nSystem.out.println(\"Detected problems: \" + logInfo.getContent().getInsights().getAnalysis().getProblems().length);\n```\n\n### Deleting a log you uploaded\n```java\nvar uploadedLog = client.uploadLog(log).get();\nuploadedLog.delete();\n\n// or store the id and token somewhere and delete later\nString logId = uploadedLog.getId();\nString deleteToken = uploadedLog.getToken();\n\nclient.deleteLog(logId, deleteToken).get();\n```\n\n### Fetch a log file's raw contents\nIf you only want the raw content without the other log information you can use the `getRawLogContent` method:\n```java\nString rawLog = client.getRawLogContent(\"HpAwPry\").get();\n```\n\n### Fetch a log file's insights\nIf you only want the insights without the other log information you can use the `getInsights` method:\n```java\nvar insights = client.getInsights(\"HpAwPry\").get();\n```\n\n### Analysing a log file without uploading it\n```java\nvar log = new Log(Paths.get(\"./logs/latest.log\"));\nvar analysisResult = client.analyseLog(log).get();\nSystem.out.println(\"Detected problems: \" + analysisResult.getAnalysis().getProblems().length);\n```\n\n### Using a self-hosted instance of mclogs\n```java\nclient.setInstance(new Instance(\"https://api.logs.example.com\"));\n```\n\n### Checking the storage limits of the current instance\n```java\nvar limits = client.getLimits().get();\nSystem.out.println(\"Max log size: \" + limits.getMaxLength());\nSystem.out.println(\"Storage duration: \" + limits.getStorageDuration());\n```\nCalls to this method are cached.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faternosorg%2Fmclogs-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faternosorg%2Fmclogs-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faternosorg%2Fmclogs-java/lists"}