Fixed problem with wildcard filenames causing invalid existence check

This commit is contained in:
Eric Fontana
2014-10-15 11:13:01 -04:00
parent bcf5195427
commit 30f61b61f1
4 changed files with 18 additions and 6 deletions

View File

@@ -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.4.0")]
[assembly: AssemblyFileVersion("1.3.4.0")]
[assembly: AssemblyVersion("1.3.5.0")]
[assembly: AssemblyFileVersion("1.3.5.0")]

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading;
@@ -41,6 +42,13 @@ namespace TimberWinR.Diagnostics
result.AsyncWaitHandle.WaitOne();
}
private Assembly GetAssemblyByName(string name)
{
return AppDomain.CurrentDomain.GetAssemblies().
SingleOrDefault(assembly => assembly.GetName().Name == name);
}
private void DiagnosticCallback(IAsyncResult result)
{
if (web == null)
@@ -52,6 +60,7 @@ namespace TimberWinR.Diagnostics
JObject json = new JObject(
new JProperty("timberwinr",
new JObject(
new JProperty("version", GetAssemblyByName("TimberWinR.ServiceHost").GetName().Version.ToString()),
new JProperty("messages", Manager.NumMessages),
new JProperty("startedon", Manager.StartedOn),
new JProperty("configfile", Manager.JsonConfig),

View File

@@ -36,9 +36,14 @@ namespace TimberWinR.Parser
{
public override JObject ToJson()
{
string field = Match[0];
string expr = Match[1];
JObject json = new JObject(
new JProperty("grok",
new JObject(
new JProperty("match", field),
new JProperty("expr", expr),
new JProperty("condition", Condition),
new JProperty("addfields", AddField),
new JProperty("addtags", AddTag),

View File

@@ -79,10 +79,7 @@ namespace TimberWinR.Inputs
try
{
Thread.CurrentThread.Priority = ThreadPriority.BelowNormal;
FileInfo fiw = new FileInfo(fileToWatch);
if (!fiw.Exists)
continue;
var qfiles = string.Format("SELECT Distinct [LogFilename] FROM {0}", fileToWatch);
var rsfiles = oLogQuery.Execute(qfiles, iFmt);
for (; !rsfiles.atEnd(); rsfiles.moveNext())
@@ -90,6 +87,7 @@ namespace TimberWinR.Inputs
var record = rsfiles.getRecord();
string logName = record.getValue("LogFilename") as string;
FileInfo fi = new FileInfo(logName);
fi.Refresh();
DateTime creationTime = fi.CreationTimeUtc;
bool logHasRolled = logFileCreationTimes.ContainsKey(logName) && creationTime > logFileCreationTimes[logName];