Hey Ben,
I have just realized that from the logs you attached it is clear that the
periodical is found and initialized. I think your periodical is silently
catching an exception in its doRun() method. You should print a helpful message
instead to check if this is the issue.
Kr,
D.
--
Tel.: +49 (0)40 609 452 077
Fax.: +49 (0)40 609 452 078
TORCH GmbH - A Graylog company
Steckelhörn 11
20457 Hamburg
Germany
Commercial Reg. (Registergericht): Amtsgericht Hamburg, HRB 125175
Geschäftsführer: Lennart Koopmann (CEO)
> On 30.06.2015, at 13:38, ben guri <[email protected]> wrote:
>
> hi Dennis,
> thanks for the quick reply,unfortunately this isn't the remedy, because I've
> already done this and followed all the steps in the documentation.
>
> Ben.
>
> On Tuesday, June 30, 2015 at 2:28:50 PM UTC+3, Dennis Oelkers wrote:
> Hey Ben,
>
> you need to include a class in your plugin jar, that is defining the bindings
> for your plugin classes. In your case it could look like this:
> https://gist.github.com/dennisoelkers/1f34ac1ca558a23ce665
>
> Kr,
> D.
>
> --
> Tel.: +49 (0)40 609 452 077
> Fax.: +49 (0)40 609 452 078
>
> TORCH GmbH - A Graylog company
> Steckelhörn 11
> 20457 Hamburg
> Germany
>
> Commercial Reg. (Registergericht): Amtsgericht Hamburg, HRB 125175
> Geschäftsführer: Lennart Koopmann (CEO)
>
> > On 30.06.2015, at 12:50, ben guri <[email protected]> wrote:
> >
> > hi,
> > my gralog server version is 1.1.3 and is installed on a centos 7 machine,
> > java version is 1.7_something.
> > so i've created a periodical plugin that just writes the date into a file
> > every 30 seconds , with the following code:
> >
> > public class DBAdapter extends Periodical {
> >
> > @Override
> > public boolean runsForever() {
> > return false;
> > }
> >
> > @Override
> > public boolean stopOnGracefulShutdown() {
> > return true;
> > }
> >
> > @Override
> > public boolean masterOnly() {
> > return false;
> > }
> >
> > @Override
> > public boolean startOnThisNode() {
> > return true;
> > }
> >
> > @Override
> > public boolean isDaemon() {
> > return true;
> > }
> >
> > @Override
> > public int getInitialDelaySeconds() {
> > return 5;
> > }
> >
> > @Override
> > public int getPeriodSeconds() {
> > return 30;
> > }
> >
> > @Override
> > protected Logger getLogger() {
> > return null;
> > }
> >
> > @Override
> > public void doRun() {
> >
> > try(PrintWriter out = new PrintWriter(new
> > BufferedWriter(new FileWriter("periodical.log", true))))
> > {
> > Date newdate = new Date();
> > out.println(newdate);
> > }
> > catch (UnsupportedEncodingException e) {
> > // TODO Auto-generated catch block
> > //e.printStackTrace();
> > } catch (FileNotFoundException e) {
> > // TODO Auto-generated catch block
> > //e.printStackTrace();
> > } catch (IOException e) {
> > // TODO Auto-generated catch block
> > //e.printStackTrace();
> > }
> > catch (Exception e) {
> > // TODO Auto-generated catch block
> > //e.printStackTrace();
> > }
> >
> > }
> > }
> >
> > then i've built the pludin using "mvn.cmd package" command (windows 7) and
> > put the plugin into graylog's plugin directory. after i restart the service
> > i get the next lines in the graylo'gs log file, telling me the plugin is
> > found and is being ran every 30 seconds just as expected :
> >
> > 2015-06-29T17:32:45.047+03:00 INFO [CmdLineTool] Loaded plugins:
> > [Anonymous Usage Statistics 1.0.7
> > [org.graylog.plugins.usagestatistics.UsageStatsPlugin], DBAdapter 1.0.0
> > [com.tradency.DBAdapterPlugin]]
> > 2015-06-29T17:32:58.973+03:00 INFO [Periodicals] Starting
> > [com.tradency.DBAdapter] periodical in [5s], polling every [30s].
> >
> > however when i look for the files that should has been created
> > (periodical.log) i cant find it. where can i get an indication that the
> > plugin's code was called and executed, and what might be the problem. i
> > couldn't manage to find any documentation regarding a periodical plugin.
> >
> > thanks,
> > Ben.
> >
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "graylog2" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "graylog2" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"graylog2" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.