Compare commits
13 Commits
test_fixtu
...
udp_v4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1468a6d0e6 | ||
|
|
44104f1e59 | ||
|
|
0b3204efe8 | ||
|
|
80f8f9ee0c | ||
|
|
9d08fc2b28 | ||
|
|
349b0bf031 | ||
|
|
8b431f92eb | ||
|
|
770ac1b7b1 | ||
|
|
5d07acad5b | ||
|
|
e4bd5be8b1 | ||
|
|
786b6b4777 | ||
|
|
51dc9ee54c | ||
|
|
796ca51f31 |
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.3.20.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.20.0")]
|
||||
[assembly: AssemblyVersion("1.3.21.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.21.0")]
|
||||
|
||||
@@ -199,11 +199,18 @@ namespace TimberWinR.TestGenerator
|
||||
switch (inputProp.Name)
|
||||
{
|
||||
case "udp":
|
||||
return VerifyConditions(json, new string[] { "udp" }, inputProp, jresult);
|
||||
|
||||
if (VerifyConditions(json, new string[] {"udp"}, inputProp, jresult) != 0)
|
||||
return 1;
|
||||
break;
|
||||
case "tcp":
|
||||
if (VerifyConditions(json, new string[] {"tcp"}, inputProp, jresult) != 0)
|
||||
return 1;
|
||||
break;
|
||||
case "log":
|
||||
case "taillog":
|
||||
return VerifyConditions(json, new string[] { "log", "taillog" }, inputProp, jresult);
|
||||
if (VerifyConditions(json, new string[] {"log", "taillog"}, inputProp, jresult) != 0)
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,9 +363,7 @@ namespace TimberWinR.TestGenerator
|
||||
}
|
||||
|
||||
private static void TimberWinROnOnConfigurationProcessed(Configuration configuration)
|
||||
{
|
||||
Console.WriteLine("Processed Config: {0}", configuration.GetHashCode());
|
||||
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Options.RedisHost) && configuration.RedisOutputs != null && configuration.RedisOutputs.Count() > 0)
|
||||
{
|
||||
foreach (var ro in configuration.RedisOutputs)
|
||||
|
||||
@@ -99,6 +99,15 @@
|
||||
<Content Include="results2.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="test3.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="test3-tw.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="results3.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TimberWinR\TimberWinR.csproj">
|
||||
|
||||
20
TimberWinR.TestGenerator/results3.json
Normal file
20
TimberWinR.TestGenerator/results3.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"Results": {
|
||||
"Inputs": [
|
||||
{
|
||||
"taillog": {
|
||||
"test1: message sent count": "[messages] == 7404",
|
||||
"test2: average cpu": "[avgCpuUsage] <= 30",
|
||||
"test3: maximum memory": "[maxMemUsage] <= 15"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tcp": {
|
||||
"test4: message sent count": "[messages] == 1234",
|
||||
"test5: average cpu": "[avgCpuUsage] <= 30",
|
||||
"test6: maximum memory": "[maxMemUsage] <= 15"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
45
TimberWinR.TestGenerator/test3-tw.json
Normal file
45
TimberWinR.TestGenerator/test3-tw.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"TimberWinR": {
|
||||
"Inputs": {
|
||||
"Tcp": [
|
||||
{
|
||||
"_comment": "Output from NLog",
|
||||
"port": 5140
|
||||
}
|
||||
],
|
||||
"Logs": [
|
||||
{
|
||||
"interval": 5,
|
||||
"logSource": "log files",
|
||||
"location": "*.jlog",
|
||||
"recurse": -1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Filters": [
|
||||
{
|
||||
"grok": {
|
||||
"condition": "\"[EventTypeName]\" == \"Information Event\"",
|
||||
"match": [
|
||||
"Text",
|
||||
""
|
||||
],
|
||||
"drop": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Outputs": {
|
||||
"Redis": [
|
||||
{
|
||||
"_comment": "Change the host to your Redis instance",
|
||||
"port": 6379,
|
||||
"batch_count": 500,
|
||||
"threads": 2,
|
||||
"host": [
|
||||
"tstlexiceapp006.vistaprint.svc"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
14
TimberWinR.TestGenerator/test3.json
Normal file
14
TimberWinR.TestGenerator/test3.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"test": "Test 3",
|
||||
"arguments": {
|
||||
"--testFile": "test3.json",
|
||||
"--testDir": "test3",
|
||||
"--timberWinRConfig": "test3-tw.json",
|
||||
"--numMessages": 1234,
|
||||
"--logLevel": "debug",
|
||||
"--tcp": "5140",
|
||||
"--jroll": ["r1.jlog", "r2.jlog"],
|
||||
"--json": ["1.jlog", "2.jlog", "3.jlog", "4.jlog"],
|
||||
"--resultsFile": "results3.json"
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,9 @@ namespace TimberWinR.Inputs
|
||||
private Thread _listenThreadV4;
|
||||
private Thread _listenThreadV6;
|
||||
private readonly int _port;
|
||||
|
||||
private long _receivedMessages;
|
||||
private long _errorCount;
|
||||
|
||||
public override JObject ToJson()
|
||||
{
|
||||
@@ -24,9 +26,9 @@ namespace TimberWinR.Inputs
|
||||
new JProperty("tcp",
|
||||
new JObject(
|
||||
new JProperty("port", _port),
|
||||
new JProperty("errors", _errorCount),
|
||||
new JProperty("messages", _receivedMessages)
|
||||
)));
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -68,7 +70,6 @@ namespace TimberWinR.Inputs
|
||||
|
||||
listener.Start();
|
||||
|
||||
|
||||
while (!CancelToken.IsCancellationRequested)
|
||||
{
|
||||
try
|
||||
@@ -79,7 +80,7 @@ namespace TimberWinR.Inputs
|
||||
// Wait for a client, spin up a thread.
|
||||
var clientThread = new Thread(new ParameterizedThreadStart(HandleNewClient));
|
||||
clientThread.Start(client);
|
||||
}
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
if (ex.SocketErrorCode == SocketError.Interrupted)
|
||||
@@ -109,7 +110,7 @@ namespace TimberWinR.Inputs
|
||||
{
|
||||
JObject json = JObject.Load(reader);
|
||||
ProcessJson(json);
|
||||
_receivedMessages++;
|
||||
Interlocked.Increment(ref _receivedMessages);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -118,12 +119,16 @@ namespace TimberWinR.Inputs
|
||||
ProcessJson(jex1);
|
||||
|
||||
LogManager.GetCurrentClassLogger().Warn(ex);
|
||||
Interlocked.Increment(ref _errorCount);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(OperationCanceledException)
|
||||
{
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.GetCurrentClassLogger().Error(ex);
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace TimberWinR.Inputs
|
||||
{
|
||||
public class UdpInputListener : InputListener
|
||||
{
|
||||
private UdpClient _udpListenerV6;
|
||||
private readonly Thread _listenThreadV6;
|
||||
private UdpClient _udpListenerV4;
|
||||
private readonly Thread _listenThreadV4;
|
||||
|
||||
private readonly int _port;
|
||||
private long _receivedMessages;
|
||||
@@ -36,13 +36,11 @@ namespace TimberWinR.Inputs
|
||||
public UdpInputListener(CancellationToken cancelToken, int port = 5140)
|
||||
: base(cancelToken, "Win32-Udp")
|
||||
{
|
||||
_port = port;
|
||||
|
||||
|
||||
_port = port;
|
||||
_receivedMessages = 0;
|
||||
|
||||
_listenThreadV6 = new Thread(StartListener);
|
||||
_listenThreadV6.Start();
|
||||
_listenThreadV4 = new Thread(StartListener);
|
||||
_listenThreadV4.Start();
|
||||
}
|
||||
|
||||
|
||||
@@ -51,31 +49,21 @@ namespace TimberWinR.Inputs
|
||||
LogManager.GetCurrentClassLogger().Info("Shutting Down {0}", InputType);
|
||||
|
||||
// close UDP listeners, which will end the listener threads
|
||||
_udpListenerV6.Close();
|
||||
_udpListenerV4.Close();
|
||||
|
||||
// wait for completion of the threads
|
||||
_listenThreadV6.Join();
|
||||
_listenThreadV4.Join();
|
||||
|
||||
base.Shutdown();
|
||||
}
|
||||
|
||||
private void StartListener()
|
||||
{
|
||||
var groupV6 = new IPEndPoint(IPAddress.IPv6Any, _port);
|
||||
// Create the socket as IPv6
|
||||
var dualModeSocket = new Socket(AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp);
|
||||
|
||||
//
|
||||
// Now, disable the IPV6only flag to make it compatable with both ipv4 and ipv6
|
||||
// See: http://blogs.msdn.com/b/malarch/archive/2005/11/18/494769.aspx
|
||||
//
|
||||
dualModeSocket.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, 0);
|
||||
dualModeSocket.Bind(groupV6);
|
||||
var groupV4 = new IPEndPoint(IPAddress.Any, _port);
|
||||
|
||||
_udpListenerV6 = new UdpClient();
|
||||
_udpListenerV6.Client = dualModeSocket;
|
||||
|
||||
LogManager.GetCurrentClassLogger().Info("Udp Input on Port {0} Ready", groupV6);
|
||||
_udpListenerV4 = new UdpClient(_port);
|
||||
|
||||
LogManager.GetCurrentClassLogger().Info("Udp Input on Port {0} Ready", groupV4);
|
||||
|
||||
string lastMessage = "";
|
||||
try
|
||||
@@ -84,13 +72,18 @@ namespace TimberWinR.Inputs
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] bytes = _udpListenerV6.Receive(ref groupV6);
|
||||
byte[] bytes = _udpListenerV4.Receive(ref groupV4);
|
||||
var data = Encoding.UTF8.GetString(bytes, 0, bytes.Length);
|
||||
lastMessage = data;
|
||||
var json = JObject.Parse(data);
|
||||
ProcessJson(json);
|
||||
Interlocked.Increment(ref _receivedMessages);
|
||||
}
|
||||
catch(ArgumentException aex)
|
||||
{
|
||||
LogManager.GetCurrentClassLogger().Error(aex);
|
||||
break;
|
||||
}
|
||||
catch(SocketException)
|
||||
{
|
||||
break;
|
||||
@@ -107,7 +100,7 @@ namespace TimberWinR.Inputs
|
||||
Interlocked.Increment(ref _parsedErrors);
|
||||
}
|
||||
}
|
||||
_udpListenerV6.Close();
|
||||
_udpListenerV4.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -150,12 +150,13 @@ namespace TimberWinR.Outputs
|
||||
{
|
||||
try
|
||||
{
|
||||
RedisClient client = new RedisClient(_redisHosts[_redisHostIndex], _port);
|
||||
client.SendTimeout = _timeout;
|
||||
RedisClient client = new RedisClient(_redisHosts[_redisHostIndex], _port);
|
||||
return client;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.GetCurrentClassLogger().Error(ex);
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -605,7 +605,7 @@ namespace TimberWinR.Parser
|
||||
Index = "logstash";
|
||||
Host = new string[] { "localhost" };
|
||||
Timeout = 10000;
|
||||
BatchCount = 50;
|
||||
BatchCount = 200;
|
||||
MaxBatchCount = BatchCount*10;
|
||||
NumThreads = 1;
|
||||
Interval = 5000;
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
A Native Windows to Redis/Elasticsearch Logstash Agent which runs as a service.
|
||||
|
||||
Version / Date
|
||||
### 1.3.21.0 - 04/13/2015
|
||||
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.4.0.0 - 04/03/2015
|
||||
### 1.3.20.0 - 04/03/2015
|
||||
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.
|
||||
|
||||
@@ -8,7 +8,7 @@ The following parameters are allowed when configuring the Redis output.
|
||||
| Parameter | Type | Description | Details | Default |
|
||||
| :-------------|:---------|:------------------------------------------------------------| :--------------------------- | :-- |
|
||||
| *threads* | string | Location of log files(s) to monitor | Number of worker theads to send messages | 1 |
|
||||
| *batch_count* | integer | Sent as a single message | Number of messages to aggregate | 10 |
|
||||
| *batch_count* | integer | Sent as a single message | Number of messages to aggregate | 200 |
|
||||
| *max_batch_count* | integer | Dynamically adjusted count maximum | Increases over time | batch_count*10 |
|
||||
| *interval* | integer | Interval in milliseconds to sleep during batch sends | Interval | 5000 |
|
||||
| *index* | string | The name of the redis list | logstash index name | logstash |
|
||||
|
||||
@@ -1,7 +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
|
||||
$silentArgs = '{D066A694-B9F7-4B35-BB7D-D34CB88CA89F} /quiet'
|
||||
$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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user