API Job/Task History - VisualCron - Forum

Community forum

RJK
  •  RJK
  • No customer Topic Starter
2014-09-19T04:13:06Z
public Server s = null;
private Client c = null;
public void vc_Export()
{
	s = getVC_Connection();
	if (s != null)
	{
		if (s.Connected)
		{
			List<JobClass> allJobs;
			allJobs = s.Jobs.GetAll();
			s.Log.GetAll();
			foreach (JobClass j in allJobs)
			{
				JobLogs = new StringBuilder();
				if (j.Stats.Active == true && ExportLogs == true)
				{
					List<LogJobHistoryClass> Logs = 
						s.Log.GetJobHistory(j.Id.ToString(), logStart, logEnd);
					Logs.ForEach(delegate(LogJobHistoryClass l)
					{
						JobLogs.Append(
							 j.Id.ToString() +
							 "|Job|" +
							 l.ExecutionId.ToString() + "|" +
							 l.Started.ToShortDateString() + "|" +
							 l.Started.ToLongTimeString() + "|" +
							 l.ExitCode.ToString() + "|" +
							 l.ExitCodeResult.ToString() +
							 "|Job|" +
							 l.ExecutionTime.ToString() + "\n");
					});
					logFile.Write(JobLogs.ToString());
				}
				TaskLogs = new StringBuilder();
				foreach (TaskClass t in j.Tasks)
				{
					if (j.Stats.Active == true && ExportLogs == true)
					{
						List<LogTaskHistoryClass> t_Logs = 
							s.Log.GetTaskHistory(t.Id, logStart, logEnd);
						t_Logs.ForEach(delegate(LogTaskHistoryClass tl)
						{
							TaskLogs.Append(
								j.Id.ToString() + "|" + 
								t.Id.ToString() + "|" + 
								tl.ExecutionId.ToString() + "|" + 
								tl.Started.ToShortDateString() + "|" +
								tl.Started.ToLongTimeString() + "|" + 
								tl.ExitCode.ToString() + "|" + 
								tl.ExitCodeResult.ToString() + "|" + 
								(tl.HasStandardError == true ? "ERROR|" : "|") + 
								tl.ExecutionTime.ToString() + "\n");
						});
					}
				} //End Foreach Tasks
				t_logFile.Write(TaskLogs.ToString());
			}//End Foreach Jobs
		}
	}
}


I was able to run the above code yesterday and get data for both jobs and tasks.
Today when I ran this, it only exported job history, not task history.

Is there a bug, or do I need to "load" logs or something for this to work?

We are using ver 7.1.7.
Support
2014-09-19T07:14:06Z
You might have some limitations in Server settings->Log->Database. By default we only store the last 2000 rows and if you have many Jobs and Tasks this is quickly rotated.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
RJK
  •  RJK
  • No customer Topic Starter
2014-09-19T14:11:00Z
Originally Posted by: Support 

You might have some limitations in Server settings->Log->Database. By default we only store the last 2000 rows and if you have many Jobs and Tasks this is quickly rotated.



Thank you Henrik.

Can you tell me how the setting works. If i dynamically change the value when I connect and reset it back to 2000 before I disconnect, would that work?

We have 1000+ jobs on this server and we have to reboot it once a month due to memory leak issues. Increasing this value and having to keep it at a high value, may cause even further issues Im afraid.

This is a completely different question about the Server. In the client app under Server->Server Info, does the Clear Memory button flush the entire "Servers" memory and force a reload?

Could this command be used in tandem with the Log Rows to extract logs?

With this many jobs and many using DateTime triggers its tough to get a "view" of the overall performance, and identify areas of improvement.
Support
2014-09-19T14:25:57Z
No, this is the value of items to store. So if you reset it back when you disconnect you will not find "old" entries later - next time you connect. But perhaps I misunderstood you.

Regarding memory issues I recommend that you use the latest 7.2.1. version. We flush memory more often and have more debugging. Let me know if you still experience issues with that one.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
RJK
  •  RJK
  • No customer Topic Starter
2014-09-19T14:34:46Z
I checked my Log Settings, They are all set to 20000, with the exception of Audit Log, those are set to 2000.

When it displays range for Tasks it states (09/18-09/19) Total rows 11681. Keep a maximum of 20000 is checked, and delete rows older than 30 days is checked as well.

Based on these settings I should of had Task level data for yesterday 9/17 but was not able to ever pull any, at any point in the day (tried several times in morning and through out the day).

Can I see in a log file somewhere, when this gets purged with stats of how many rows it purged and possibly the date range?

We are installing the update to fix the memory issues this weekend. We will keep you posted on its results.

Thanks for your help and assistance Henrik,
RJK
RJK attached the following image(s):
Support
2014-10-06T11:06:59Z
Could be something about the time you supply. Do you see the rows in the Client?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top