Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Logpresso App Examples

Working examples for the Logpresso App SDK. A Logpresso app is an OSGi bundle that extends the platform — with data collection, detection content, query commands, and its own screens in the console.

logpresso-sample-app

One app that covers both extension tracks end to end:

Extension point What it shows Source
Connect profile Managing an endpoint and API key as reusable configuration impl/SampleConnectProfileFactory.java
Logger A reconfigurable logger impl/SampleLogger.java, impl/SampleLoggerFactory.java
Query commands Parsing a custom command and streaming rows from a REST API query/
REST API plugin Serving JSON to the app's own screen msgbus/SamplePlugin.java
XDR UI A React screen mounted in the console src/main/ui/

The query commands and the UI read the same connect profile, so one endpoint and API key configured in the console serves both.

Requirements

  • JDK 11 (Eclipse Temurin recommended)
  • Apache Maven 3.6 or later
  • Logpresso Sonar 5.0 to install into

Node.js and npm are not prerequisites: the Maven build downloads them into src/main/ui/node. Install Node 20 locally only if you want the fast UI development loop described below.

Build

cd logpresso-sample-app
mvn clean package

This produces two identical files in target/:

  • logpresso-sample-app-1.1.2608.0.jar — the OSGi bundle
  • logpresso-sample-app-1.1.2608.0.app — the same bundle under the name Logpresso installs

The build runs the frontend first: it downloads node, runs npm install, then vite build, which writes the compiled assets into src/main/resources/WEB-INF. Maven packages that directory into the bundle, and Logpresso serves it at /app/sample/.

Install

Upload the .app file in the console, under Apps. Then register a connect profile of type Sample with an endpoint and API key, and open Sample App > Subnet Groups.

UI development loop

Rebuilding the whole bundle for a CSS change is slow. Run the UI on its own instead:

cd logpresso-sample-app/src/main/ui
copy .env.example .env.local     :: cp on macOS/Linux — then fill in SONAR_API_KEY
npm install
npm run dev

This serves the app at http://localhost:6100 and proxies /api/sonar/sample to SONAR_URL (default https://localhost), so the screen talks to a real Logpresso instance.

SONAR_API_KEY is required. Installed in the console the app is served from the same address and inherits the login session, but the dev server runs on a different address, so the browser does not send the session cookie and every call would return 401. The proxy sends the key as a bearer token instead. Issue one in the console under Users → your account → Common settings → API key. .env.local is git-ignored, so the key stays on your machine.

Working with an AI agent

AGENTS.md holds the build, runtime, and design-system contracts an agent needs to extend this app or scaffold a new one. Claude Code and other agents that read AGENTS.md pick it up automatically; copy it into your own app repository as a starting point.

Documentation

License

See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages