13 Commits

Author SHA1 Message Date
Eric Fontana
e98ef89fe2 Updated uninstaller to match new installer. 2015-04-13 08:41:40 -04:00
Eric Fontana
6461369d39 Embed msi 2015-04-13 08:05:30 -04:00
Eric Fontana
f5b2858c1c Don't check in MSI files. 2015-04-13 07:44:55 -04:00
Eric Fontana
3d0bfc248d Stage the MSI for chocolatey 2015-04-13 07:42:58 -04:00
Eric Fontana
dbaa52a12e Embed the MSI into chocolatey package 2015-04-13 07:31:06 -04:00
Eric Fontana
7e69175f19 Updated to use new Timestamp 2015-04-13 06:47:43 -04:00
Eric Fontana
baa70eebbc Merge pull request #43 from Cimpress-MCP/udp_v4
Rolled Udp input listener support to ipv4 only.
2015-04-13 06:46:17 -04:00
Eric Fontana
29308446a9 Merge pull request #44 from thoean/UseUtcForEventLog
Use utc for event log
2015-04-13 06:46:01 -04:00
Eric Fontana
a0cccc0b7f Merge pull request #42 from thoean/SortableDateInReleaseNotes
Use sortable date format to avoid confusion between dd/MM and MM/dd
2015-04-13 06:45:16 -04:00
Markus Thurner
ec2ec66915 Convert TimeGenerated and TimeWritten to UTC. 2015-04-13 12:27:36 +02:00
Markus Thurner
98ef675f9c Wait for threads to be completed before shutting down, and naming threads for easier debugging. 2015-04-13 12:27:19 +02:00
Markus Thurner
22baef9838 Minor cleanup 2015-04-13 12:08:20 +02:00
Markus Thurner
1b51fcd989 Use sortable date format to avoid confusion between dd/MM and MM/dd. 2015-04-13 11:56:04 +02:00
8 changed files with 59 additions and 59 deletions

1
.gitignore vendored
View File

@@ -155,3 +155,4 @@ $RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
packages
*.msi

View File

@@ -167,7 +167,7 @@ following options:
TimberWinR.ServiceHost.exe -configFile:myconfig.json -logLevel:Debug
```
## Automatic Installation via Chocolatey
## Automatic Installation via Chocolatey (embedded)
[TimbeWinR Chocolatey](https://chocolatey.org/packages/TimberWinR)

View File

@@ -1,17 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.AccessControl;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using Interop.MSUtil;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using NLog;
using TimberWinR.Parser;
using LogQuery = Interop.MSUtil.LogQueryClassClass;
using EventLogInputFormat = Interop.MSUtil.COMEventLogInputContextClassClass;
using LogRecordSet = Interop.MSUtil.ILogRecordset;
@@ -23,13 +16,13 @@ namespace TimberWinR.Inputs
/// </summary>
public class WindowsEvtInputListener : InputListener
{
private int _pollingIntervalInSeconds = 1;
private TimberWinR.Parser.WindowsEvent _arguments;
private readonly int _pollingIntervalInSeconds = 1;
private readonly WindowsEvent _arguments;
private long _receivedMessages;
private List<Thread> _tasks { get; set; }
private readonly List<Thread> _tasks;
public bool Stop { get; set; }
public WindowsEvtInputListener(TimberWinR.Parser.WindowsEvent arguments, CancellationToken cancelToken)
public WindowsEvtInputListener(WindowsEvent arguments, CancellationToken cancelToken)
: base(cancelToken, "Win32-Eventlog")
{
_arguments = arguments;
@@ -38,8 +31,7 @@ namespace TimberWinR.Inputs
foreach (string eventHive in _arguments.Source.Split(','))
{
string hive = eventHive.Trim();
var thread = new Thread(new ParameterizedThreadStart(EventWatcher));
var thread = new Thread(EventWatcher) {Name = "Win32-Eventlog-" + eventHive};
_tasks.Add(thread);
thread.Start(eventHive);
}
@@ -48,7 +40,11 @@ namespace TimberWinR.Inputs
public override void Shutdown()
{
Stop = true;
LogManager.GetCurrentClassLogger().Info("Shutting Down {0}", InputType);
LogManager.GetCurrentClassLogger().Info("Shutting Down {0}", InputType);
foreach (var thread in _tasks)
{
thread.Join();
}
base.Shutdown();
}
@@ -76,8 +72,6 @@ namespace TimberWinR.Inputs
{
string location = ploc.ToString();
LogQuery oLogQuery = new LogQuery();
LogManager.GetCurrentClassLogger().Info("WindowsEvent Input Listener Ready");
// Instantiate the Event Log Input Format object
@@ -93,9 +87,7 @@ namespace TimberWinR.Inputs
resolveSIDs = _arguments.ResolveSIDS
};
oLogQuery = null;
Dictionary<string, Int64> logFileMaxRecords = new Dictionary<string, Int64>();
var logFileMaxRecords = new Dictionary<string, Int64>();
using (var syncHandle = new ManualResetEventSlim())
{
@@ -107,7 +99,7 @@ namespace TimberWinR.Inputs
{
try
{
oLogQuery = new LogQuery();
var oLogQuery = new LogQuery();
var qfiles = string.Format("SELECT Distinct [EventLog] FROM {0}", location);
var rsfiles = oLogQuery.Execute(qfiles, iFmt);
@@ -145,21 +137,19 @@ namespace TimberWinR.Inputs
object v = record.getValue(field.Name);
if (field.Name == "Data")
v = ToPrintable(v.ToString());
if ((field.Name == "TimeGenerated" || field.Name == "TimeWritten") && field.DataType == typeof (DateTime))
v = ((DateTime) v).ToUniversalTime();
json.Add(new JProperty(field.Name, v));
}
var lrn = (Int64)record.getValueEx("RecordNumber");
logFileMaxRecords[fileName] = lrn;
record = null;
ProcessJson(json);
_receivedMessages++;
json = null;
}
// Close the recordset
rs.close();
rs = null;
GC.Collect();
}
if (!Stop)

View File

@@ -3,11 +3,12 @@
A Native Windows to Redis/Elasticsearch Logstash Agent which runs as a service.
Version / Date
### 1.3.21.0 - 04/13/2015
### 1.3.21.0 - 2015-04-13
1. Rolled Udp listener support to V4 only, too many issues with dual mode sockets
and hosts file. If we want to add this back, I will add a Udpv6 input.
### 1.3.20.0 - 04/03/2015
### 1.3.20.0 - 2015-04-03
1. A re-factoring of Logs and TailLogs to be more efficient and detect log rolling correctly,
this requires http://support.microsoft.com/en-us/kb/172190 which will be detected and
set by TimberWinR, however, requires a reboot.
@@ -15,11 +16,12 @@ Version / Date
3. Created TimberWinR.TestGenerator for complete testing of TimberWinR
4. Fixed ipv4/ipv6 thread-safe issue with UdpInputListener which might lead to corrupted input data.
### 1.3.19.1 - 03/03/2015
### 1.3.19.1 - 2015-03-03
1. Added new Redis parameter _max\_batch\_count_ which increases the _batch\_count_ dynamically over time
to handle input flooding. Default is _batch\_count_ * 10
### 1.3.19.0 - 02/26/2015
### 1.3.19.0 - 2015-02-26
1. Added support for Multiline codecs for Stdin and Logs listeners, closes issue [#23](https://github.com/Cimpress-MCP/TimberWinR/issues/23)
2. Added new TailFiles input type which uses a native implementation (more-efficient) than using LogParser's Log
@@ -28,61 +30,60 @@ Version / Date
5. Fixed bug when tailing non-existent log files which resulted in high cpu-usage.
6. Added feature to watch the configuration directory
### 1.3.18.0 - 12/22/2014
### 1.3.18.0 - 2014-12-22
1. Fixed bug introduced in 1.3.17.0 which changed the meaning of the delay for Elasticsearch, Redis and Stdout
intervals to be interpreted as seconds instead of milliseconds. 1.3.17.0 should not be used.
2. Removed ability for installer to downgrade which was leading to leaving previous versions laying around (i.e. reverts 1.3.13.0 change)
### 1.3.17.0 - 12/19/2014
### 1.3.17.0 - 2014-12-19
1. Continued work improving shutdown time by using syncHandle.Wait instead of Thread.Sleep
### 1.3.16.0 - 12/19/2014
### 1.3.16.0 - 2014-12-19
1. Added logSource property to the Log input to facility the steering of log messages to different indices.
### 1.3.15.0 - 12/12/2014
### 1.3.15.0 - 2014-12-12
1. Fixed bug whereby if the Udp or Tcp inputs receive an impropery formatted Json it caused the thread to terminate, and ignore
future messages.
### 1.3.14.0 - 12/11/2014
### 1.3.14.0 - 2014-12-11
1. Fixed bug with the Grok filter to match properly the value of the Text field against non-blank entries.
### 1.3.13.0 - 12/02/2014
### 1.3.13.0 - 2014-12-02
1. Fixed MSI installer to allow downgrades.
### 1.3.12.0 - 11/25/2014
### 1.3.12.0 - 2014-11-25
1. Fixed all remaining memory leaks due to the COM Weak Surrogate which requires an explicit GC.Collect
### 1.3.11.0 - 11/21/2014
### 1.3.11.0 - 2014-11-21
1. Re-worked WindowsEvent listener to enable shutting down in a quicker fashion.
### 1.3.10.0 - 11/18/2014
### 1.3.10.0 - 2014-11-18
1. Refactored Conditions handler to use non-leaking evaluator.
### 1.3.9.0 - 11/11/2014
### 1.3.9.0 - 2014-11-11
1. Merged in pull request #9
2. Updated chocolately uninstall to preserve GUID
### 1.3.8.0 - 11/06/2014
### 1.3.8.0 - 2014-11-06
1. Added interval parameter to WindowsEvent input listener
2. Increased default value for interval to 60 seconds for polling WindowsEvents
### 1.3.7.0 - 10/21/2014
### 1.3.7.0 - 2014-10-21
1. Added additional information for diagnostics port
2. Completed minor handling of Log rolling detection
### 1.3.6.0 - 10/16/2014
### 1.3.6.0 - 2014-10-16
1. Handle rolling of logs whereby the logfile remains the same, but the content resets back to 0 bytes.

View File

@@ -98,10 +98,12 @@
</CreateProperty>
</Target>
<PropertyGroup>
<PostBuildEvent>$(SolutionDir)\TimberWinR.ExtractID\$(OutDir)\TimberWinR.ExtractID.exe $(TargetDir) $(SolutionDir)chocolateyUninstall.ps1.guid $(SolutionDir)chocolateyUninstall.ps1.template</PostBuildEvent>
<PreBuildEvent>mkdir $(SolutionDir)tools
cmd.exe /c copy $(SolutionDir)chocolateyUninstall.ps1.template.orig $(SolutionDir)chocolateyUninstall.ps1.template</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>cmd.exe /c copy $(SolutionDir)chocolateyUninstall.ps1.template.orig $(SolutionDir)chocolateyUninstall.ps1.template</PreBuildEvent>
<PostBuildEvent>$(SolutionDir)\TimberWinR.ExtractID\$(OutDir)\TimberWinR.ExtractID.exe $(TargetDir) $(SolutionDir)chocolateyUninstall.ps1.guid $(SolutionDir)chocolateyUninstall.ps1.template
cmd.exe /c copy "$(TargetDir)%2a.msi" "$(SolutionDir)tools"</PostBuildEvent>
</PropertyGroup>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -1,8 +1,14 @@
$packageName = 'TimberWinR-${version}'
$installerType = 'msi'
$url = 'http://www.ericfontana.com/TimberWinR/TimberWinR-${version}.0.msi'
$fileType = 'msi'
$silentArgs = '/quiet'
$validExitCodes = @(0)
Install-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" "$url64" -validExitCodes $validExitCodes
$scriptPath = $(Split-Path $MyInvocation.MyCommand.Path)
$fileFullPath = Join-Path $scriptPath 'TimberWinR-${version}'
try {
Install-ChocolateyInstallPackage $packageName $fileType $silentArgs $fileFullPath
} catch {
Write-ChocolateyFailure $packageName $($_.Exception.Message)
throw
}

View File

@@ -1,8 +1,9 @@
$packageName = 'TimberWinR-${version}' # arbitrary name for the package, used in messages
$installerType = 'msi' #only one of these: exe, msi, msu
$url = 'http://www.ericfontana.com/TimberWinR/TimberWinR-${version}.0.msi' # download url
$scriptPath = $(Split-Path $MyInvocation.MyCommand.Path)
$fileFullPath = Join-Path $scriptPath 'TimberWinR-${version}'
$silentArgs = '${PROJECTGUID} /quiet'
$validExitCodes = @(0) #please insert other valid exit codes here, exit codes for ms http://msdn.microsoft.com/en-us/library/aa368542(VS.85).aspx
UnInstall-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" -validExitCodes $validExitCodes
UnInstall-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "fileFullPath" -validExitCodes $validExitCodes

View File

@@ -1,8 +1,7 @@
$packageName = 'TimberWinR-${version}' # arbitrary name for the package, used in messages
$installerType = 'msi' #only one of these: exe, msi, msu
$url = 'http://www.ericfontana.com/TimberWinR/TimberWinR-${version}.0.msi' # download url
$scriptPath = $(Split-Path $MyInvocation.MyCommand.Path)
$fileFullPath = Join-Path $scriptPath 'TimberWinR-${version}'
$silentArgs = '${PROJECTGUID} /quiet'
$validExitCodes = @(0) #please insert other valid exit codes here, exit codes for ms http://msdn.microsoft.com/en-us/library/aa368542(VS.85).aspx
UnInstall-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" -validExitCodes $validExitCodes
UnInstall-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "fileFullPath" -validExitCodes $validExitCodes