in Education by
Is this possible? From what I'm seeing, the only way to get options into the the python class is to hard code them in the python destination's options. I need to set a variable path based on macros like $HOST but python destination options don't seem to be interpolated. I need a way to pass in macro values like $HOST to the init() method. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
The value of $HOST changes for every message, so you actually need it in send(), not in init(). What you might really want is something like this: class MyDestination(object): # ... def send(self, msg): host = msg["HOST"] # ... return True Or you can use templates starting from v3.18: import syslogng class MyDestination(object): def init(self, options): self.log_template = syslogng.LogTemplate("$HOST") # ... return True def send(self, msg): formatted_string = self.log_template.format(msg, self.template_options) # ... return True

Related questions

0 votes
    I am looking for a way to return the interpolated coordinate value of a variable at a query variable value ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    What is the meaning of _ after for in this code? if tbh.bag: n = 0 for _ in tbh.bag.atom_set(): n += 1 Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    Alright, I know how to print variables and strings. But how can I print something like "My string" card.price ... variable card.price). Select the correct answer from above options...
asked Jan 26, 2022 in Education by JackTerrance
0 votes
    webbrowser.open('https://api.WhatsApp.com/send?phone=number') I want to send WhatsApp messages to numbers without ... in this link. Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    In python, I want to sum all of the values in a variable. My code is x=100 y=200 for i in range(a,b) ... of all numbers which is 7500. Select the correct answer from above options...
asked Jan 11, 2022 in Education by JackTerrance
0 votes
    In the python documentation, an instance of a named_tuple is created by using the below code: Point = named_tuple(' ... of doing it? Select the correct answer from above options...
asked Jan 10, 2022 in Education by JackTerrance
0 votes
    How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, ... a configuration option. Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    How can I remove emojis that start with '\x' when reading a csv file using pandas in Python? The ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    I need to create a hollow pyramid with a solid top layer like so: Height: 5 * *** * * * ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 5, 2022 in Education by JackTerrance
0 votes
    I could swear I've seen the function (or method) that takes a list, like this [3, 7, 19] ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    I could swear I've seen the function (or method) that takes a list, like this [3, 7, 19] ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    I am using Eclipse with Pydev and googleAppengine. I have python 2.7 installed. I am trying to run ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I am getting an 'access is denied' error when I attempt to delete a folder that is not empty. I used the ... that is not empty? Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    I want to change a couple of files at one time, iff I can write to all of them. I'm wondering if I ... to this problem look like? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I've always laughed to myself when I've looked back at my VB6 days and thought, "What modern language doesn't ... ++/-- notation? Select the correct answer from above options...
asked Jan 28, 2022 in Education by JackTerrance
...