Be more pessimistic upon restarts
This commit is contained in:
@@ -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.21.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.21.0")]
|
||||
[assembly: AssemblyVersion("1.3.22.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.22.0")]
|
||||
|
||||
@@ -108,6 +108,9 @@
|
||||
<Content Include="results3.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="test3-twconfig.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TimberWinR\TimberWinR.csproj">
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
""
|
||||
],
|
||||
"drop": "true"
|
||||
},
|
||||
"json": {
|
||||
"type": "Win32-TailFile",
|
||||
"source": "Text",
|
||||
"promote": "Text"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"--timberWinRConfig": "test1-twconfig.json",
|
||||
"--numMessages": 1234,
|
||||
"--logLevel": "debug",
|
||||
"--udp-host": "::1",
|
||||
"--udp-host": "localhost",
|
||||
"--udp": "5140",
|
||||
"--jroll": ["r1.jlog", "r2.jlog"],
|
||||
"--json": ["1.jlog", "2.jlog", "3.jlog", "4.jlog"],
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"--testDir": "test2",
|
||||
"--timberWinRConfig": "test2-tw.json",
|
||||
"--numMessages": 1234,
|
||||
"--logLevel": "debug",
|
||||
"--logLevel": "trace",
|
||||
"--udp": "5140",
|
||||
"--jroll": ["r1.jlog", "r2.jlog"],
|
||||
"--json": ["1.jlog", "2.jlog", "3.jlog", "4.jlog"],
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"TimberWinR": {
|
||||
"Inputs": {
|
||||
"Tcp": [
|
||||
"Udp": [
|
||||
{
|
||||
"_comment": "Output from NLog",
|
||||
"port": 5140
|
||||
}
|
||||
],
|
||||
"Logs": [
|
||||
"TailFiles": [
|
||||
{
|
||||
"interval": 5,
|
||||
"logSource": "log files",
|
||||
"location": "*.jlog",
|
||||
"location": "d:\\logs\\sta\\sta.log",
|
||||
"recurse": -1
|
||||
}
|
||||
]
|
||||
@@ -25,6 +25,11 @@
|
||||
""
|
||||
],
|
||||
"drop": "true"
|
||||
},
|
||||
"json": {
|
||||
"type": "Win32-TailFile",
|
||||
"source": "Text",
|
||||
"promote": "Text"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
50
TimberWinR.TestGenerator/test3-twconfig.json
Normal file
50
TimberWinR.TestGenerator/test3-twconfig.json
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"TimberWinR": {
|
||||
"Inputs": {
|
||||
"Udp": [
|
||||
{
|
||||
"_comment": "Output from NLog",
|
||||
"port": 5140
|
||||
}
|
||||
],
|
||||
"TailFiles": [
|
||||
{
|
||||
"interval": 5,
|
||||
"logSource": "log files",
|
||||
"location": "d:\\logs\\sta\\sta.log",
|
||||
"recurse": -1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Filters": [
|
||||
{
|
||||
"grok": {
|
||||
"condition": "\"[EventTypeName]\" == \"Information Event\"",
|
||||
"match": [
|
||||
"Text",
|
||||
""
|
||||
],
|
||||
"drop": "true"
|
||||
},
|
||||
"json": {
|
||||
"type": "Win32-TailFile",
|
||||
"source": "Text",
|
||||
"promote": "Text"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Outputs": {
|
||||
"Redis": [
|
||||
{
|
||||
"_comment": "Change the host to your Redis instance",
|
||||
"port": 6379,
|
||||
"batch_count": 500,
|
||||
"threads": 2,
|
||||
"host": [
|
||||
"tstlexiceapp006.vistaprint.svc"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,6 @@
|
||||
"--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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,14 @@ namespace TimberWinR.Inputs
|
||||
//seek to the last max offset
|
||||
LogManager.GetCurrentClassLogger().Trace("{0}: File: {1} Seek to: {2}", Thread.CurrentThread.ManagedThreadId, fileName, lastMaxOffset);
|
||||
|
||||
reader.BaseStream.Seek(lastMaxOffset, SeekOrigin.Begin);
|
||||
var seekedTo = reader.BaseStream.Seek(lastMaxOffset, SeekOrigin.Begin);
|
||||
|
||||
// We couldn't seek to the position, so remember what we have seeked to.
|
||||
if (seekedTo != lastMaxOffset)
|
||||
{
|
||||
lastMaxOffset = seekedTo;
|
||||
LogsFileDatabase.Update(dbe, true, lastMaxOffset);
|
||||
}
|
||||
|
||||
//read out of the file until the EOF
|
||||
string line = "";
|
||||
@@ -202,12 +209,13 @@ namespace TimberWinR.Inputs
|
||||
{
|
||||
LogManager.GetCurrentClassLogger().Debug(":{0} Starting Thread Tailing File: {1}", Thread.CurrentThread.ManagedThreadId, dbe.FileName);
|
||||
LogsFileDatabase.Update(dbe, false, dbe.LastPosition);
|
||||
SaveVisitedFileName(fileName);
|
||||
|
||||
Task.Factory.StartNew(() => TailFileWatcher(fileName));
|
||||
}
|
||||
else if (!isWildcardPattern)
|
||||
{
|
||||
FileInfo fi = new FileInfo(dbe.FileName);
|
||||
SaveVisitedFileName(fileName);
|
||||
|
||||
//LogManager.GetCurrentClassLogger().Info("Located File: {0}, New: {1}", dbe.FileName, dbe.NewFile);
|
||||
long length = fi.Length;
|
||||
@@ -219,7 +227,7 @@ namespace TimberWinR.Inputs
|
||||
LogsFileDatabase.Roll(dbe);
|
||||
}
|
||||
// Log has rolled or this is a file we are seeing for the first time.
|
||||
bool processWholeFile = logHasRolled || !dbe.ProcessedFile;
|
||||
bool processWholeFile = logHasRolled || !dbe.ProcessedFile || dbe.NewFile;
|
||||
if (processWholeFile)
|
||||
{
|
||||
LogsFileDatabase.Update(dbe, true, 0);
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
A Native Windows to Redis/Elasticsearch Logstash Agent which runs as a service.
|
||||
|
||||
Version / Date
|
||||
|
||||
### 1.3.22.0 - 2015-04-14
|
||||
1. Fixed minor bug with TailFiles and service re-starts not picking up
|
||||
rolled files right away.
|
||||
|
||||
### 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.
|
||||
|
||||
Reference in New Issue
Block a user