-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from datalust/dev
2.0.0 Release
- Loading branch information
Showing
132 changed files
with
2,701 additions
and
4,016 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,82 +1,73 @@ | ||
$ErrorActionPreference = 'Stop' | ||
|
||
$framework = 'netcoreapp3.1' | ||
|
||
function Clean-Output | ||
{ | ||
Write-Output "Cleaning output" | ||
if(Test-Path ./artifacts) { rm ./artifacts -Force -Recurse } | ||
} | ||
|
||
function Restore-Packages | ||
{ | ||
& nuget restore | ||
} | ||
|
||
function Update-AssemblyInfo($version) | ||
{ | ||
$versionPattern = "[0-9]+(\.([0-9]+|\*)){3}" | ||
|
||
$file = "./src/Seq.Forwarder.Administration/Properties/AssemblyInfo.cs" | ||
(cat $file) | foreach { | ||
% {$_ -replace $versionPattern, "$version.0" } | ||
} | sc -Encoding "UTF8" $file | ||
if($LASTEXITCODE -ne 0) { exit 1 } | ||
Write-Output "Restoring packages" | ||
& dotnet restore | ||
} | ||
|
||
function Update-WixVersion($version) | ||
function Execute-Tests | ||
{ | ||
$defPattern = "define Version = ""0\.0\.0""" | ||
$def = "define Version = ""$version""" | ||
$product = ".\setup\SeqForwarder\Product.wxs" | ||
|
||
(cat $product) | foreach { | ||
% {$_ -replace $defPattern, $def } | ||
} | sc -Encoding "UTF8" $product | ||
if($LASTEXITCODE -ne 0) { exit 1 } | ||
Write-Output "Testing native platform version" | ||
& dotnet test ./test/Seq.Forwarder.Tests/Seq.Forwarder.Tests.csproj -c Release /p:Configuration=Release /p:Platform=x64 /p:VersionPrefix=$version | ||
if($LASTEXITCODE -ne 0) { exit 3 } | ||
} | ||
|
||
function Execute-MSBuild($version, $suffix) | ||
function Create-ArtifactDir | ||
{ | ||
Write-Output "Building $version (suffix=$suffix)" | ||
|
||
if ($suffix) { | ||
& msbuild ./seq-forwarder.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64 /p:VersionPrefix=$version /p:VersionSuffix=$suffix | ||
} else { | ||
& msbuild ./seq-forwarder.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64 /p:VersionPrefix=$version | ||
} | ||
if($LASTEXITCODE -ne 0) { exit 1 } | ||
Write-Output "Creating artifacts directory" | ||
mkdir ./artifacts | ||
} | ||
|
||
function Execute-Tests | ||
function Publish-Archives($version) | ||
{ | ||
pushd ./test/Seq.Forwarder.Tests | ||
$rids = @("linux-x64", "osx-x64", "win-x64") | ||
foreach ($rid in $rids) { | ||
Write-Output "Publishing archive for $rid" | ||
|
||
& dotnet publish src/Seq.Forwarder/Seq.Forwarder.csproj -c Release -f $framework -r $rid /p:VersionPrefix=$version /p:SeqForwarderRid=$rid | ||
if($LASTEXITCODE -ne 0) { exit 4 } | ||
|
||
& dotnet test -c Release | ||
if($LASTEXITCODE -ne 0) { exit 3 } | ||
# Make sure the archive contains a reasonable root filename | ||
mv ./src/Seq.Forwarder/bin/Release/$framework/$rid/publish/ ./src/Seq.Forwarder/bin/Release/$framework/$rid/seqfwd-$version-$rid/ | ||
|
||
popd | ||
} | ||
if ($rid.StartsWith("win-")) { | ||
& ./build/7-zip/7za.exe a -tzip ./artifacts/seqfwd-$version-$rid.zip ./src/Seq.Forwarder/bin/Release/$framework/$rid/seqfwd-$version-$rid/ | ||
if($LASTEXITCODE -ne 0) { exit 5 } | ||
} else { | ||
& ./build/7-zip/7za.exe a -ttar seqfwd-$version-$rid.tar ./src/Seq.Forwarder/bin/Release/$framework/$rid/seqfwd-$version-$rid/ | ||
if($LASTEXITCODE -ne 0) { exit 5 } | ||
|
||
function Publish-Artifacts($version, $suffix) | ||
{ | ||
$dashsuffix = ""; | ||
if ($suffix) { | ||
$dashsuffix = "-$suffix"; | ||
# Back to the original directory name | ||
mv ./src/Seq.Forwarder/bin/Release/$framework/$rid/seqfwd-$version-$rid/ ./src/Seq.Forwarder/bin/Release/$framework/$rid/publish/ | ||
|
||
& ./build/7-zip/7za.exe a -tgzip ./artifacts/seqfwd-$version-$rid.tar.gz seqfwd-$version-$rid.tar | ||
if($LASTEXITCODE -ne 0) { exit 6 } | ||
|
||
rm seqfwd-$version-$rid.tar | ||
} | ||
} | ||
mkdir ./artifacts | ||
mv ./setup/SeqForwarder/bin/Release/SeqForwarder.msi ./artifacts/SeqForwarder-$version$dashsuffix.msi | ||
if($LASTEXITCODE -ne 0) { exit 1 } | ||
} | ||
|
||
Push-Location $PSScriptRoot | ||
|
||
$version = @{ $true = $env:APPVEYOR_BUILD_VERSION; $false = "99.99.99" }[$env:APPVEYOR_BUILD_VERSION -ne $NULL]; | ||
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL]; | ||
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; | ||
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"] | ||
Write-Output "Building version $version" | ||
|
||
Clean-Output | ||
Create-ArtifactDir | ||
Restore-Packages | ||
Update-WixVersion $version | ||
Update-AssemblyInfo $version | ||
Execute-MSBuild $version $suffix | ||
Publish-Archives($version) | ||
Execute-Tests | ||
Publish-Artifacts $version $suffix | ||
|
||
Pop-Location | ||
|
||
Write-Output "Done." |
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 |
---|---|---|
@@ -1,11 +1,7 @@ | ||
# Seq Forwarder [](https://ci.appveyor.com/project/datalust/seq-forwarder) [](https://gitter.im/datalust/seq) [](https://github.com/datalust/seq-forwarder/releases) | ||
|
||
[Seq Forwarder](http://blog.getseq.net/help-us-test-seq-forwarder/) is a client-side tool for sending log data to Seq. | ||
|
||
### HTTP forwarding | ||
|
||
Seq Forwarder can run as a Windows service on client machines. It receives events over a local HTTP | ||
API and persists these to its own internal storage until the remote Seq server can be reached. | ||
Seq Forwarder is a client-side log collector that receives events over its local HTTP API and persists them to its own | ||
internal storage until a remote Seq server can be reached. | ||
|
||
 | ||
|
||
|
@@ -21,88 +17,122 @@ Log.Logger = new LoggerConfiguration() | |
Log.Information("Hello, Seq Forwarder!"); | ||
``` | ||
|
||
### Importing JSON log files | ||
|
||
The `seq-forwarder import` command can be used to import JSON log files directly into Seq. The log file needs to | ||
be in Serilog's native JSON format (e.g. produced by the [Seq sink](https://github.com/serilog/serilog-sinks-seq) or | ||
Serilog's `JsonFormatter`) with one JSON-encoded event per line. | ||
|
||
``` | ||
seq-forwarder import -f myapp.json -u https://my-seq -p User=appuser1 -p [email protected] | ||
``` | ||
|
||
The command will print a GUID `ImportId` that will be attached to the imported events in Seq. Additional properties | ||
can be specified on the command-line, like `User=` and `Email=` above, to tag the events. | ||
Client applications can specify an API key when logging to Seq Forwarder. In this case the API key supplied by the client | ||
will be forwarded along to the target Seq server. | ||
|
||
### Building | ||
Alternatively, Seq Forwarder can be configured with an API key, and will use this to log to Seq when client applications do not specify one. | ||
|
||
Visual Studio 2017 is required. The solution is currently a Windows-only .NET 4.5.2 application. .NET Core support is intended sometime after its RTM. | ||
## Getting started | ||
|
||
You will need [Wix 3.10](http://wixtoolset.org) to build the setup/MSI. | ||
First, download the release bundle for your platform, and extract it to a suitable location. | ||
|
||
### Debugging | ||
The instructions below use the `seqfwd` command-line. To learn about available commands, try `seqfwd help`. | ||
|
||
`F5` will work, but you will need to either run the `install` command (see below) to create an HTTP namespace | ||
reservation, or run as Administrator (on Windows). | ||
### On Windows | ||
|
||
### Deployment | ||
To set up Seq Forwarder as a Windows service, from an administrative PowerShell prompt in the Seq Forwarder directory, | ||
set the target Seq server URL and an optional API key: | ||
|
||
The outputs from _Seq.Forwarder_ and _Seq.Forwarder.Administration_ (if required) projects can be XCOPY-deployed. | ||
|
||
### Setup | ||
|
||
Run `Seq.Forwarder.Administration.exe` to install the forwarder, or check out the command-line for scripted setup. | ||
|
||
|
||
### Troubleshooting | ||
|
||
By default the "forwarder" logs will be stored under `%PROGRAMDATA%\Seq\Logs`. If the destination is not available, an exception will be stored in these log files. | ||
```powershell | ||
./seqfwd config -k output.serverUrl --value="http://seq.example.com/" | ||
./seqfwd config -k output.apiKey --value="1a2b3c4d5e6f" | ||
./seqfwd config -k storage.bufferSizeBytes -v 1073741824 | ||
./seqfwd install | ||
./seqfwd start | ||
``` | ||
|
||
If you need to inspect the current configuration, it can be found at: `%PROGRAMDATA%\Seq\Forwarder\SeqForwarder.json` | ||
The default buffer size limit is 64 MB. In the example, this is increased to 1 GB. | ||
|
||
### Command-line usage | ||
To upgrade, stop the service, overwrite the forwarder release bundle, and restart the service. | ||
|
||
**List available commands:** | ||
On Windows, Seq Forwarder will used machine-scoped DPAPI to encrypt the default API key and any API keys supplied by | ||
clients. | ||
|
||
``` | ||
seq-forwarder help | ||
``` | ||
## On macOS or Linux | ||
|
||
**Get command help:** | ||
On Linux, you'll need `liblmdb`: | ||
|
||
``` | ||
seq-forwarder help <command> | ||
apt install liblmdb-dev | ||
``` | ||
|
||
**Install as a Windows service:** | ||
To run Seq Forwarder, configure the target Seq server URL, and optionally, an API key: | ||
|
||
``` | ||
seq-forwarder install | ||
```shell | ||
./seqfwd config -k output.serverUrl --value="http://seq.example.com/" | ||
./seqfwd config -k output.apiKey --value="1a2b3c4d5e6f" | ||
./seqfwd config -k storage.bufferSizeBytes -v 1073741824 | ||
./seqfwd run | ||
``` | ||
|
||
**Set destination Seq server details:** | ||
**Note** that on macOS and Linux, the output API key and any API keys provided by clients will be stored in plain text. | ||
|
||
``` | ||
seq-forwarder config -k output.serverUrl --value="http://my-seq/" | ||
seq-forwarder config -k output.apiKey --value="1234567890" | ||
``` | ||
The default buffer size cap is 64 MB. In the example, this is increased to 1 GB. | ||
|
||
**Start the Windows service:** | ||
## Development | ||
|
||
``` | ||
seq-forwarder start | ||
``` | ||
Seq Forwarder is a .NET Core application that can be built using the .NET Core SDK on Windows, macOS, and Linux. | ||
|
||
**Run interactively:** | ||
To debug, `F5` will work, but on Windows you will need to either run the `install` command (see below) to create an HTTP namespace | ||
reservation, or run as Administrator. | ||
|
||
``` | ||
seq-forwarder run | ||
``` | ||
## Troubleshooting | ||
|
||
**Change the buffer size cap (defaults to 64 MB):** | ||
By default the "forwarder" logs will be stored under `%PROGRAMDATA%\Seq\Logs`. If the destination Seq server is not | ||
available, an exception will be stored in these log files. | ||
|
||
``` | ||
seq-forwarder config -k storage.bufferSizeBytes -v 1073741824 | ||
seq-forwarder restart | ||
``` | ||
If you need to inspect the current configuration, it can be found at: `%PROGRAMDATA%\Seq\Forwarder\SeqForwarder.json` | ||
|
||
## Command line usage | ||
|
||
``` | ||
> ./seqfwd help | ||
Usage: seqfwd <command> [<args>] | ||
Available commands are: | ||
bind-ssl Bind an installed SSL certificate to an HTTPS port served by Seq | ||
Forwarder | ||
config View and set fields in the SeqForwarder.json file; run with no | ||
arguments to list all fields | ||
dump Print the complete log buffer contents as JSON | ||
help Show information about available commands | ||
install Install the Seq Forwarder as a Windows service | ||
restart Restart the Windows service | ||
run Run the server interactively | ||
start Start the Windows service | ||
status Show the status of the Seq Forwarder service | ||
stop Stop the Windows service | ||
truncate Clear the log buffer contents | ||
uninstall Uninstall the Windows service | ||
version Print the current executable version | ||
``` | ||
|
||
Note that the Windows HTTP and service-related commands (`bind-ssl`, `install`, `restart`, `start`, `status`, `stop`, | ||
and `uninstall`) are only available on that platform. | ||
|
||
## _SeqForwarder.json_ configuration example | ||
|
||
The `seqfwd config` command reads and writes _SeqForwarder.json_: | ||
|
||
```json | ||
{ | ||
"diagnostics": { | ||
"internalLogPath": "C:\\ProgramData\\Seq\\Logs\\", | ||
"internalLoggingLevel": "Information" | ||
}, | ||
"output": { | ||
"serverUrl": "http://localhost:5341", | ||
"eventBodyLimitBytes": 262144, | ||
"rawPayloadLimitBytes": 10485760, | ||
"apiKey": null | ||
}, | ||
"storage": { | ||
"bufferSizeBytes": 67108864 | ||
}, | ||
"api": { | ||
"listenUri": "http://localhost:15341" | ||
} | ||
} | ||
``` | ||
|
||
On Windows, this file lives in `C:\ProgramData\Seq\Forwarder`. |
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 |
---|---|---|
@@ -1,16 +1,20 @@ | ||
version: 1.1.{build} | ||
version: 2.0.{build} | ||
skip_tags: true | ||
image: Visual Studio 2017 | ||
build_script: | ||
- ps: ./Build.ps1 | ||
test: off | ||
image: Visual Studio 2019 | ||
|
||
artifacts: | ||
- path: artifacts/*.msi | ||
- path: artifacts/seqfwd-*.zip | ||
- path: artifacts/seqfwd-*.tar.gz | ||
|
||
build_script: | ||
- ps: ./Build.ps1 -shortver "$($env:APPVEYOR_BUILD_VERSION)" | ||
|
||
deploy: | ||
- provider: GitHub | ||
auth_token: | ||
secure: Bo3ypKpKFxinjR9ShkNekNvkob2iklHJU+UlYyfHtcFFIAa58SV2TkEd0xWxz633 | ||
artifact: /SeqForwarder-.*\.msi/ | ||
tag: v$(appveyor_build_version) | ||
on: | ||
branch: master | ||
- provider: GitHub | ||
auth_token: | ||
secure: Bo3ypKpKFxinjR9ShkNekNvkob2iklHJU+UlYyfHtcFFIAa58SV2TkEd0xWxz633 | ||
artifact: /seqfwd-.*\.(zip|tar\.gz)/ | ||
tag: v$(appveyor_build_version) | ||
on: | ||
branch: main | ||
|
Oops, something went wrong.