-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Initial app packaging (WIP) * Image rename * Toolchain is Gnu * Use alternative capabilities: configuration schema * Install Rust in setup.ps1 * Install step rather than init step * Fix path * Fix name of gelfAddress setting * Output verbose logs from cargo build * Continue on errors so that cargo output is visible * Redirect cargo's STDERR * Write events to STDERR as valid CLEF * Very simple pygelf example * Use grayscale Seq logo for package icon * Publish to NuGet
- Loading branch information
1 parent
b7e663b
commit 66d4dcc
Showing
14 changed files
with
227 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | ||
<metadata> | ||
<id>Seq.Input.Gelf</id> | ||
<version>$version$</version> | ||
<authors>Datalust and Contributors</authors> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<description>Receive GELF event payloads via UDP.</description> | ||
<language>en-US</language> | ||
<projectUrl>https://github.com/datalust/sqelf</projectUrl> | ||
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl> | ||
<iconUrl>https://raw.githubusercontent.com/datalust/sqelf/master/asset/seq-input-gelf.png</iconUrl> | ||
<tags>seq-app</tags> | ||
</metadata> | ||
<files> | ||
<file src="seq-input-gelf.d.json" target="" /> | ||
<file src="target\x86_64-pc-windows-msvc\release\sqelf.exe" target="win-x64" /> | ||
<file src="target\x86_64-unknown-linux-gnu\release\sqelf" target="linux-x64\sqelf" /> | ||
</files> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
$ErrorActionPreference = "Stop" | ||
|
||
$RequiredRustToolchain = "stable" | ||
|
||
Invoke-WebRequest -OutFile ./rustup-init.exe -Uri https://win.rustup.rs | ||
$ErrorActionPreference = "Continue" | ||
& ./rustup-init.exe --default-host x86_64-pc-windows-msvc --default-toolchain $RequiredRustToolchain -y | ||
if ($LASTEXITCODE) { exit 1 } | ||
$ErrorActionPreference = "Stop" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Example logging with https://github.com/keeprocking/pygelf | ||
# First, `pip install pygelf` | ||
|
||
from pygelf import GelfUdpHandler | ||
import logging | ||
|
||
logging.basicConfig(level=logging.INFO) | ||
logger = logging.getLogger() | ||
logger.addHandler(GelfUdpHandler(host='127.0.0.1', port=12201)) | ||
|
||
logger.info('Hello, Seq+GELF!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"$schema": "https://getseq.net/schema/app-definition/v3", | ||
"name": "GELF Input", | ||
"description": "Accept Graylog Extended Log Format (GELF) payloads over UDP. Requires Seq 5.1+ for optimal performance.", | ||
"capabilities": ["input"], | ||
"platform": { | ||
"win-x64": { | ||
"executable": "win-x64\\sqelf.exe" | ||
}, | ||
"linux-x64": { | ||
"executable": "linux-x64/sqelf" | ||
} | ||
}, | ||
"settings": { | ||
"gelfAddress": { | ||
"displayName": "GELF address", | ||
"helpText": "The socket address (IP address and port) on which the input will listen for UDP GELF payloads. The default is `0.0.0.0:12201`.", | ||
"isOptional": true | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,7 @@ version = "1" | |
|
||
[dependencies.failure] | ||
version = "0.1" | ||
|
||
[dependencies.chrono] | ||
version = "0.4" | ||
features = ["serde"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use chrono::{DateTime, Utc}; | ||
use std::fmt::Display; | ||
|
||
#[derive(Serialize)] | ||
struct DiagnosticEvent<'a> { | ||
#[serde(rename="@t")] | ||
timestamp: DateTime<Utc>, | ||
|
||
#[serde(rename="@l")] | ||
level: &'static str, | ||
|
||
#[serde(rename="@mt")] | ||
message_template: &'static str, | ||
|
||
#[serde(rename="@x")] | ||
error: Option<&'a str>, | ||
} | ||
|
||
impl<'a> DiagnosticEvent<'a> { | ||
pub fn new(level: &'static str, error: Option<&'a str>, message_template: &'static str) -> DiagnosticEvent<'a> { | ||
DiagnosticEvent { | ||
timestamp: Utc::now(), | ||
message_template, | ||
level, | ||
error, | ||
} | ||
} | ||
} | ||
|
||
pub fn emit_err(error: &impl Display, message_template: &'static str) { | ||
let err_str = format!("{}", error); | ||
let evt = DiagnosticEvent::new("ERROR", Some(&err_str), &message_template); | ||
let json = serde_json::to_string(&evt).expect("infallible JSON"); | ||
eprintln!("{}", json); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.