Using PowerShell to fetch logs and emptying monitored directory at specified intervals

View thread

PT_537256

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.