Skip to content
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

How do I automate this? - K13333: Filtering log messages sent to remote syslog servers (11.x - 15.x) #230

Open
Ronnie110755 opened this issue Oct 19, 2022 · 9 comments

Comments

@Ronnie110755
Copy link

I don't know if this is the appropriate place to post this issue. Apologies in advance.

Regarding the article: K13333: Filtering log messages sent to remote syslog servers (11.x - 15.x)

There are certain changes to be made to the sys config if we want to be able to filter out specific syslog events. i.e.

ENTER: tmsh
modify sys syslog remote-servers none
save sys config
edit sys syslog all-properties

You will enter a vi editor, so use vi commands:
Replace the include none line with the desired syslog filter.

delete line: include none
AT that same line, insert via cut and paste the following text:

include "
filter f_remote_loghost {
level(warn..emerg);
};

destination d_remote_loghost {
tcp("10.7.3.11" port(1468));
udp("10.7.3.11" port(514));
};

log {
source(s_syslog_pipe);
filter(f_remote_loghost);
destination(d_remote_loghost);
};
"

exit the vi editor by saving the file

The issue is, since we want to roll this out to new devices via automation, I am looking for ways to automate this particular change.
I get the sense that this won't be possible with Declarative Onboarding. I am not sure if it is possible with the Imperative model or not since it involves editing the syslog porting of the config file.

It could be scripted outside of those two methods but it would be great to be able to incorporate it in someway either via Postman or Ansible.

Any help ????

Many Thanks,
rjc

@f5-rahm
Copy link

f5-rahm commented Oct 19, 2022

You can PUT to https://host/mgmt/tm/sys/syslog and update the include attribute.

@Ronnie110755
Copy link
Author

Thank you sir! I'll give it a go!

@f5-rahm
Copy link

f5-rahm commented Oct 19, 2022

@Ronnie110755 I created (and tested locally) an example with python and bigrest in python in this gist

@Ronnie110755
Copy link
Author

Ronnie110755 commented Oct 19, 2022 via email

@f5-rahm
Copy link

f5-rahm commented Oct 19, 2022

Yes @Ronnie110755, if you want to use a postman collection, you can do that as well. Just PUT to https://host/mgmt/tm/sys/syslog with json body like:

{"include": "syslog config details here...use \n for line breaks"}

Just for additional context for objects like this one, it is an unnamed resource, so you can't create them, you can just update them. You only need to provide the attributes you want to change. If there is no prior syslog configuration present, the include attribute isn't even present in the rest object when you request it.

@Ronnie110755
Copy link
Author

Ronnie110755 commented Oct 20, 2022 via email

@Ronnie110755
Copy link
Author

no pictures were included in my message above.... live and learn

@Ronnie110755
Copy link
Author

Postman working too - NEXT!!!!
Thanks Jason - Much Obliged!

@f5-rahm
Copy link

f5-rahm commented Oct 20, 2022

glad they are working. You do need to save config for it to persist, though.

<POST> /mgmt/tm/sys/config -d '{"command":"save"}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants