-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document Sematext Logsene. Add rsyslog.conf overwrite feature. #15
Conversation
…text Logsene environment variables.
Thx for the PR, much appreciated. Question on the RSYSLOG_CONFIG_BASE64 var: do you consider it essential? I ask because one design goal is to have the capability to run the container read-only, what obviously is not possible if that feature is used. Of course, we can document this, but I wonder if it is worth the deviation from intended use case. |
@tgjamin I have another question, and it is primarily for me to understand the usability of this container (remember, we are in the early stages). The idea behind the container setup is to have an easy to use config file that shall be modified. This here https://github.com/rsyslog/rsyslog-docker/blob/master/appliance/alpine/internal/container_config. The container provides a command to modify the config. The meta config happens to use environment variables. Thus you can also overwrite the config by setting and importing them, I guess much like you do. Questions for me:
Again, I am trying to create the best possible usability for this container and so this are actually honest questions. Anyone else is also invited to provide feedback, of course. @deoren @radu-gheorghe @otisg @portante would be great if you could find time to comment |
Let me see if I get the options right: one is to provide environment variables for essential things (such as Logsene token - or Elasticsearch index name, same thing), and the other one is to provide the whole config as an environment variable? If I got it right, are the two options mutually exclusive? Or is it just the concern that if the whole config is provided then the original rsyslog becomes irrelevant, other environment variables are overridden (or not?) and in general things would be more complex/confusing? |
The design of the rsyslog appliance container is as follows: we want an easy config layer for "standard things" like logging to logsense. So that users do not need to know all the details about queues, rulesets etc to get things going. We call this "meta config". It is actually a single file. You can see this file via
and edit it via
Or alternatively by editing the file inside the volume. More details on the meta config are here (slide 15 is maybe a good start): https://www.slideshare.net/rainergerhards1/rsyslog-meets-docker In the meta config, we use environment variables. These were originally not meant to be overwritten by something else. This PR now introduces/recommend to set the environment variables outside of the container config. This works, but is a bit dangerous, as the meta config sets some default values, just not for logsene. That is because the meta config right now assumes it has full control over the environment variables - what was the actual design. Of course, we can change that easily if so desired. So the first question is if we need to support passing environment variables directly into the container rather than using the meta config layer. If so, that requires some internal changes to be reliable. I would also like to understand why this may be beneficial.
They are mutually exclusive, as the passed-in config overwrites the container one and so disables the meta config. Presentation slide 19 (best 15..19) shows the relationship between meta config and rsyslog.conf. But my second question is a bit different: if we permit to rewrite rsyslog.conf via a container variable, we cannot execute the container in read-only mode. One of the design goals was to make this possible, because
So I ask if it is worth giving up the ability, at least when using this feature. Side-note: we ourselves demand the the container is non-read only, but if and only if it is put into debug mode. Here, we need it writable because we need to install debug symbols and other helpers which are not present by default, because really not needed other than for debug. I hope that explains my thoughts and concerns. Again, I do not object the proposed changes, but would like to understand the reasons in order to craft the best possible container. Any questions please let me know. |
Thanks for explaining this so clearly, Rainer! I am familiar with the presentation, but now I understand things better :) It sounds like the meta config layer is a nicer way to do things. Whether we should allow overriding it or not - I'm really not sure. I would guess it's down to what is easier to use, in case someone needs to change the provided rsyslog.conf beyond what the container provides. Environment variables (as provided in this PR) are one solution, I suppose changing rsyslog.conf from the container definition is another (though it won't be as easy to run the container from Docker Hub). I don't have a clear preference here, though it sounds like allowing to override the whole config is a slightly better option. I still don't understand why providing a different file excludes the meta config layer. Can't the provided config file say
and, if the I have a feeling I'm missing some important stuff here still, so maybe others can provide more valuable feedback. |
I am on the run, so for today just this:
Assuming that someone copies all of the provided rsyslog.conf support for the meta config, it would continue to work. My assumption was that it is really replaced by a custom config. IMHO rsyslog.conf get's far less readable when the meta config is applied, so I would have expected that if someone really wants to considerably depart from the build-in config use cases, the full config is replaced. Probably a wrong assumption on my side? |
I think I got it now. Then it sounds like the two aren't mutually exclusive. We would want people to use the meta config layer (it's easier, as you said), but if they need more power, this PR seems to give them that. Unless I'm missing something, it sounds like a good idea. We do a similar thing with Sematext Docker Agent here: https://sematext.com/docs/sematext-docker-agent/configuration/ (look for LOGAGENT_PATTERNS and LOGAGENT_PATTERNS_BASE64). @megastef did that part, and because of that I assume it's a good Docker practice :) |
I am new to rsyslog configuration, so still getting a feel for the project and configuration methods. I appreciate the feedback on the PR and will do my best to address the questions. As @radu-gheorghe pointed out, the sematext-docker-agent has an environment variable @radu-gheorghe pointed out:
This is correct. A user of the container would not be required to inject environment variables but could choose to (if they wanted). The default On slide 30 of https://www.slideshare.net/rainergerhards1/rsyslog-meets-docker I noticed the future work of "imfile rewrite, permit to monitor "external" files (on host machine)". We accomplished this with the current container by mounting logs into the container read-only during
We would need a way to overwrite the default rsyslog.conf file in an automated way, without manually running the
Perhaps the Here is an example of running with logsene enabled and configured to log
Please let me know if I failed to address any questions. |
@tgjamin Thanks a lot for your very clear response. It is extremely helpful to me. Just note that I am finalizing things for the next rsyslog release, so a proper reply from me may take a short while, but it for sure will happen. I would appreciate if you could also advise from time to time on how we proceed with the container. Based on your feedback, I am definitely able to provide an even more useful container! |
Hi @rgerhards just wanted to check in to see how review/discussion on this PR is going since it's been a little over two weeks. |
@tgjamin sorry, we are a relatively small project and lots of things are going on. I need to change a bit of the overall structure of doc etc as the PR only addresses part of it. If I just merge as-is without changing the rest (all the other config options), things become inconsistent. If it is really urgent for you, I can do so, but I would prefer to have on consistent step. side-note, you probably know this much better than I do: my plan is to add a tag |
@rgerhards Totally understand the small team and lots of work. I'm not in an urgent rush to get this merged. If I need the feature sooner, I will just work off of a fork of the project. I know I mentioned changing the code a bit to overwrite the
Should I update the PR sometime to reflect this, or wait until later? As for tagging of the docker images, having the |
I would appreciate if you could update the PR. I'll try to do some more work on the container over the weekend or during next week. |
Changed the PR to create a |
@tgjamin many thanks again for your contribution, much appreciated. Will merge now and update the container. Tag Any more suggestions, comments, hints or actual code you could contribute is highly appreciated! |
container images has now also been updated and is using 8.34 now |
Tozny is interested in using this container for remote logging of files on it's servers. We use Sematext Logsene, so this container was very interesting to us as this feature was already built. We dug through the configuration, and got it working with our Logsene app.
This PR includes documentation on the environment variables needed for making Logsene work. Also included, is the addition of the
RSYSLOG_CONFIG_BASE64
environment variable. This allows injection of arsyslog.conf
file into the container, without mounting a volume or file into the container. If the environment variable is not set, thestarter.sh
script does not overwrite the/etc/rsyslog.conf
file and the script continues.