Using PowerShell to fetch logs and emptying monitored directory at specified intervals
I'm looking at a slightly unusual application logging which has turned out quite challenging to handle with NXLog, as is, and for that I've been experimenting of running PS scripts using NXLog. In principle, I'd like to know if it is possible to build the following scenario using NXLog Enterprise agent.
Running of PS script (using NXLog) to fetch log files at interval from variable directories and putting them into another (a copy of logs not older than 1 hour, PS script would manage this, but needs to be invoked by NXLog agent). Reading selected events from the fetched logs and dispatching them to another system (note, this is completed in another scenario already so I know this would work). Deleting of all logs from the import directory after they have been read. This could be managed with the xm_fileop, I believe.
I have been experimenting of running PS scripts, unsuccesfully so far, but I'm going through the docs and examples to understand how would one execute a (any) script using the NXLog agent.
Any advice will be highly appreciated.
Hi,
If I understood you correctly - I think what you trying to achieve is fairly doable, I suppose using PS might be not needed if solved correctly. The conf
might be a bit complex in this case, but unless I miss something - shouldn't be a problem.
How about we start with seeing what have you already done? Let's use it as a starting point, and we'll try to give you some hints on what's next.
Regards,
Rafal