Skip to content

Commit 83b5b9e

Browse files
authored
Merge pull request #89 from datalust/dev
2020.4.0 Release
2 parents 3ca460e + 24a4eea commit 83b5b9e

File tree

17 files changed

+354
-9
lines changed

17 files changed

+354
-9
lines changed

Build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if($LASTEXITCODE -ne 0) { exit 1 }
1414

1515
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
1616
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
17-
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"]
17+
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"]
1818

1919
echo "build: Version suffix is $suffix"
2020

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var installedApps = await connection.Apps.ListAsync();
3131

3232
**To authenticate**, the `SeqConnection` constructor accepts an `apiKey` parameter (make sure the API key permits _user-level access_) or, if you want to log in with personal credentials you can `await connection.Users.LoginAsync(username, password)`.
3333

34-
For a more complete example, see the [seq-tail app included in the source](https://github.com/datalust/seq-api/blob/master/example/SeqTail/Program.cs).
34+
For a more complete example, see the [seq-tail app included in the source](https://github.com/datalust/seq-api/blob/main/example/SeqTail/Program.cs).
3535

3636
#### Creating entities
3737

@@ -43,7 +43,7 @@ signal.Title = "Signal 123";
4343
await connection.Signals.AddAsync(signal);
4444
```
4545

46-
See the [signal-copy app](https://github.com/datalust/seq-api/blob/master/example/SignalCopy/Program.cs) for an example of this pattern in action.
46+
See the [signal-copy app](https://github.com/datalust/seq-api/blob/main/example/SignalCopy/Program.cs) for an example of this pattern in action.
4747

4848
### Reading events
4949

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ deploy:
1212
secure: sMicBLl7Z83H/mhX10DL7Yqwa80ZHUbb9fRHKmxd5m2MN2DWAE1kbYH/GPQPFajZ
1313
skip_symbols: true
1414
on:
15-
branch: /^(master|dev)$/
15+
branch: /^(main|dev)$/
1616
- provider: GitHub
1717
auth_token:
1818
secure: hX+cZmW+9BCXy7vyH8myWsYdtQHyzzil9K5yvjJv7dK9XmyrGYYDj/DPzMqsXSjo
1919
artifact: /Seq.Api.*\.nupkg/
2020
tag: v$(appveyor_build_version)
2121
on:
22-
branch: master
22+
branch: main

example/SeqEnableAAD/Program.cs

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using DocoptNet;
4+
using Seq.Api;
5+
using Seq.Api.Model.Settings;
6+
7+
namespace SeqEnableAAD
8+
{
9+
class Program
10+
{
11+
const string Usage = @"seq-enable-aad: enable authentication on your Seq server (for initial setup of a new Seq server only).
12+
13+
Usage:
14+
seq-enable-aad.exe <server> --uname=<un> --tenantid=<tid> --clientid=<cid> --clientkey=<ckey> [--authority=<a>]
15+
seq-enable-aad.exe (-h | --help)
16+
17+
Options:
18+
-h --help Show this screen.
19+
--uname=<un> Username. Azure Active Directory usernames must take the form of an email address.
20+
--tenantid=<tid> Tenant ID.
21+
--clientid=<cid> Client ID.
22+
--clientkey=<ckey> Client key.
23+
--authority=<a> Authority (optional, defaults to 'login.windows.net').
24+
";
25+
static void Main(string[] args)
26+
{
27+
Task.Run(async () =>
28+
{
29+
try
30+
{
31+
var arguments = new Docopt().Apply(Usage, args, version: "Seq Enable AAD 0.1", exit: true);
32+
33+
var server = arguments["<server>"].ToString();
34+
var username = Normalize(arguments["--uname"]);
35+
var tenantId = Normalize(arguments["--tenantid"]);
36+
var clientId = Normalize(arguments["--clientid"]);
37+
var clientKey = Normalize(arguments["--clientkey"]);
38+
var authority = Normalize(arguments["--authority"]);
39+
40+
await Run(server, username, tenantId, clientId, clientKey, authority);
41+
}
42+
catch (Exception ex)
43+
{
44+
Console.ForegroundColor = ConsoleColor.White;
45+
Console.BackgroundColor = ConsoleColor.Red;
46+
Console.WriteLine("seq-enable-aad: {0}", ex);
47+
Console.ResetColor();
48+
Environment.Exit(-1);
49+
}
50+
}).Wait();
51+
}
52+
53+
static string Normalize(ValueObject v)
54+
{
55+
if (v == null) return null;
56+
var s = v.ToString();
57+
return string.IsNullOrWhiteSpace(s) ? null : s;
58+
}
59+
60+
static async Task Run(string server, string username, string tenantId, string clientId, string clientKey, string authority="login.windows.net")
61+
{
62+
var connection = new SeqConnection(server);
63+
64+
var user = await connection.Users.FindCurrentAsync();
65+
var provider = await connection.Settings.FindNamedAsync(SettingName.AuthenticationProvider);
66+
var cid = await connection.Settings.FindNamedAsync(SettingName.AzureADClientId);
67+
var ckey = await connection.Settings.FindNamedAsync(SettingName.AzureADClientKey);
68+
var aut = await connection.Settings.FindNamedAsync(SettingName.AzureADAuthority);
69+
var tid = await connection.Settings.FindNamedAsync(SettingName.AzureADTenantId);
70+
71+
user.Username = username;
72+
provider.Value = "Azure Active Directory";
73+
cid.Value = clientId;
74+
ckey.Value = clientKey;
75+
tid.Value = tenantId;
76+
aut.Value = authority;
77+
78+
await connection.Users.UpdateAsync(user);
79+
await connection.Settings.UpdateAsync(cid);
80+
await connection.Settings.UpdateAsync(ckey);
81+
await connection.Settings.UpdateAsync(tid);
82+
await connection.Settings.UpdateAsync(aut);
83+
84+
await connection.Settings.UpdateAsync(provider); // needs to go before IsAuthenticationEnabled but after the other settings
85+
86+
var iae = await connection.Settings.FindNamedAsync(SettingName.IsAuthenticationEnabled);
87+
iae.Value = true;
88+
await connection.Settings.UpdateAsync(iae); // this update needs to happen last, as enabling auth will lock this connection out
89+
}
90+
}
91+
}

example/SeqEnableAAD/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Seq Enable AAD (Azure Active Directory)
2+
3+
Be sure to read the [Seq Azure Active Directory documentation](https://docs.datalust.co/docs/azure-active-directory) to find the manual AAD setup instructions.
4+
5+
## Example usage:
6+
7+
```
8+
seq-enable-aad.exe https://seq.example.com [email protected] --clientid=xxxxxx --tenantid=xxxxxx --clientkey=xxxxxx --authority=login.windows.net
9+
```
10+
11+
### **Important note:**
12+
13+
#### Windows
14+
15+
Don't forget to set the "canonical URI" which Seq uses as a reply address for AAD.
16+
17+
```
18+
seq config -k api.canonicalUri -v https://seq.example.com
19+
seq service restart
20+
```
21+
22+
#### Linux / Docker
23+
24+
Don't forget to include the BASE_URI which Seq uses as a reply address for AAD.
25+
26+
```
27+
docker run -d \
28+
--restart unless-stopped \
29+
--name seq \
30+
-p 5341:80 \
31+
-e ACCEPT_EULA=Y \
32+
-e BASE_URI=https://seq.example.com \
33+
datalust/seq:latest
34+
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
<RootNamespace>SeqEnableAuth</RootNamespace>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="docopt.net" Version="0.6.1.9" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<ProjectReference Include="..\..\src\Seq.Api\Seq.Api.csproj" />
15+
</ItemGroup>
16+
17+
</Project>

seq-api.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SeqTail", "example\SeqTail\
2727
EndProject
2828
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignalCopy", "example\SignalCopy\SignalCopy.csproj", "{E8CDDE17-8E29-4EB4-A4BB-38BCE346A752}"
2929
EndProject
30+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SeqEnableAAD", "example\SeqEnableAAD\SeqEnableAAD.csproj", "{035B62FC-CAD7-4DF9-A2A3-FAAA64DF3B55}"
31+
EndProject
3032
Global
3133
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3234
Debug|Any CPU = Debug|Any CPU
@@ -53,6 +55,10 @@ Global
5355
{E8CDDE17-8E29-4EB4-A4BB-38BCE346A752}.Debug|Any CPU.Build.0 = Debug|Any CPU
5456
{E8CDDE17-8E29-4EB4-A4BB-38BCE346A752}.Release|Any CPU.ActiveCfg = Release|Any CPU
5557
{E8CDDE17-8E29-4EB4-A4BB-38BCE346A752}.Release|Any CPU.Build.0 = Release|Any CPU
58+
{035B62FC-CAD7-4DF9-A2A3-FAAA64DF3B55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
59+
{035B62FC-CAD7-4DF9-A2A3-FAAA64DF3B55}.Debug|Any CPU.Build.0 = Debug|Any CPU
60+
{035B62FC-CAD7-4DF9-A2A3-FAAA64DF3B55}.Release|Any CPU.ActiveCfg = Release|Any CPU
61+
{035B62FC-CAD7-4DF9-A2A3-FAAA64DF3B55}.Release|Any CPU.Build.0 = Release|Any CPU
5662
EndGlobalSection
5763
GlobalSection(SolutionProperties) = preSolution
5864
HideSolutionNode = FALSE
@@ -63,6 +69,7 @@ Global
6369
{34BBD428-8297-484E-B771-0B72C172C264} = {1C66E116-DC21-4C8F-833E-A4C2DDF58487}
6470
{42CEBFBA-208F-40F1-AC95-13F05F6D5412} = {1C66E116-DC21-4C8F-833E-A4C2DDF58487}
6571
{E8CDDE17-8E29-4EB4-A4BB-38BCE346A752} = {1C66E116-DC21-4C8F-833E-A4C2DDF58487}
72+
{035B62FC-CAD7-4DF9-A2A3-FAAA64DF3B55} = {1C66E116-DC21-4C8F-833E-A4C2DDF58487}
6673
EndGlobalSection
6774
GlobalSection(ExtensibilityGlobals) = postSolution
6875
SolutionGuid = {20BAB483-FB94-4373-8E4C-0F846B6DBFFC}

src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ public class ServerMetricsEntity : Entity
2828
public ServerMetricsEntity()
2929
{
3030
}
31+
32+
/// <summary>
33+
/// The start time in UTC of the events in the memory cache.
34+
/// </summary>
35+
public DateTime? EventStoreCacheStart { get; set; }
36+
37+
/// <summary>
38+
/// The end time in UTC of the events in the memory cache.
39+
/// </summary>
40+
public DateTime? EventStoreCacheEnd { get; set; }
3141

3242
/// <summary>
3343
/// The number of days of events able to fit in the memory cache.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
3+
namespace Seq.Api.Model.Diagnostics.Storage
4+
{
5+
/// <summary>
6+
/// A description of a column in a rowset.
7+
/// </summary>
8+
public readonly struct ColumnDescriptionPart
9+
{
10+
/// <summary>
11+
/// A label for the column.
12+
/// </summary>
13+
public string Label { get; }
14+
15+
/// <summary>
16+
/// Additional metadata describing the role of the column; this is separate from,
17+
/// but related to, the runtime type of the column values.
18+
/// </summary>
19+
public ColumnType Type { get; }
20+
21+
/// <summary>
22+
/// Construct a <see cref="ColumnDescriptionPart"/>.
23+
/// </summary>
24+
/// <param name="label">A label for the column.</param>
25+
/// <param name="type">Additional metadata describing the role of the column; this is separate from,
26+
/// but related to, the runtime type of the column values.</param>
27+
public ColumnDescriptionPart(string label, ColumnType type)
28+
{
29+
Label = label ?? throw new ArgumentNullException(nameof(label));
30+
Type = type;
31+
}
32+
}
33+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace Seq.Api.Model.Diagnostics.Storage
2+
{
3+
/// <summary>
4+
/// Additional metadata describing the role of a column; this is separate from,
5+
/// but related to, the runtime type of the column values.
6+
/// </summary>
7+
public enum ColumnType
8+
{
9+
/// <summary>
10+
/// The column contains general data.
11+
/// </summary>
12+
General,
13+
14+
/// <summary>
15+
/// The column contains timestamps that may be used to create a timeseries.
16+
/// </summary>
17+
Timestamp,
18+
}
19+
}

0 commit comments

Comments
 (0)