Giter VIP home page Giter VIP logo

Comments (10)

crayfishx avatar crayfishx commented on August 15, 2024

I presume this only happens when you declare both classes

from puppet-splunk.

crayfishx avatar crayfishx commented on August 15, 2024

This seems to be the same issue raised in #48 - FYI

from puppet-splunk.

Vincent-- avatar Vincent-- commented on August 15, 2024

I don't think this is related to #48
indeed, this issue only happens if I declare both classes. This is due to this part of the code in forwarder.pp:

  case $::kernel {
    'Linux': {
      class { '::splunk::platform::posix':
        splunkd_port => $splunkd_port,
        splunk_user  => $splunk_user,
      }
    }

A workaround might be to use ensure_resource or ensure_resources from https://github.com/puppetlabs/puppetlabs-stdlib

The real fix should be to define 2 different ports in the param class: one for the forwarder and an other for the splunk server and to use an include instead of a class call (see init.pp for instance).

Happy to create a PR if everybody agrees on that.

from puppet-splunk.

Vincent-- avatar Vincent-- commented on August 15, 2024

Btw, I've been able to make it works on my setup using this dirty workaround:

Class['::splunk::forwarder'] -> Class['::splunk']

The class ::splunk::platform::posix in forwarder.pp is then called before the include of the same class in init.pp, but this is definitely not a proper fix

from puppet-splunk.

crayfishx avatar crayfishx commented on August 15, 2024

I don't think ensure_resource works on classes (clarification?)

I've been looking at a longer term fix to considerably rewrite a lot of that structure, including getting rid of the swathe of virtual resources, tagging, collectors...etc, it's overkill. But that won't be a quick fix - if you want to submit a PR in the mean time if you can solve the issue without too much engineering then we can release that as a patch release until a more permanent rewrite of those classes.

from puppet-splunk.

ffrank avatar ffrank commented on August 15, 2024

ensure_resource does not work with classes. Declaring classes is much different from resources, despite the unified syntax.

Also please note that replacing a class { <name>: ... } declaration with include <name> is not a safe way of resolving multiple declaration issues, except if we can make sure that only the include syntax is being used.

The basic problem is that there is no good way to pass class parameters from multiple places in the manifest. I have not looked at the module's structure in detail, but generally, a safe workaround is to eliminate public classes outside the main class from init.pp, and provide parameters to allow including (only) the desired other classes from the main.

from puppet-splunk.

Vincent-- avatar Vincent-- commented on August 15, 2024

There was another issue related to the 'splunk enable boot-start' command line so I've asked a question on the splunk forum about that. From the answer, it's not recommended to use both splunk-forwarder and splunk-server on the same server (as apparently splunk-server can provide the splunk-forwarder capabilities)

See https://answers.splunk.com/answers/469814/how-can-i-enable-both-splunk-server-and-splunk-uni.html

Might be better to generate an error message if someone tries to use both class on the same node (instead of the warning about different ports) and also update the doc about this possibility.
Thoughts about that?

from puppet-splunk.

ffrank avatar ffrank commented on August 15, 2024

Hi, sorry for the delay.

Well, "not recommended" is one thing, but outright forbidding it in the module feels a bit harsh. Some users will know what they're doing and that will cause problems for them.

I still believe that refactoring the module interface is the way to go forward, if possible.

from puppet-splunk.

Vincent-- avatar Vincent-- commented on August 15, 2024

Hi,

No pb. When I first tried to install Splunk, I didnt know splunk server can act as a forwarder too and that mislead me. I wanted to install both the splunk-forwarder and the splunk-server.
Now my setup is using only splunk-server on the master and splunk-agent on all the slave and that works perfectly.

There is a lot of issues if you try to install both of them on the same server (partially due to this module but mainly because splunk has not been build to be configured this way).

I think an error message or at least a warning might lead the user in the good direction.
If you think of a particular case when both of them are required, we shoud avoid the warning but I cannot think of any real case on my side.

Regards,
Vincent

from puppet-splunk.

ffrank avatar ffrank commented on August 15, 2024

Oh that's good info. I'm thinking we could

  • fail the manifest if the classes are combined
  • make the error message indicate an override parameter
  • explain in the docs of that parameter what you said above

from puppet-splunk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.