Feature #745
Syslog type support
| Status: | Investigating | Start date: | ||
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | newfeature | |||
| Target version: | - | |||
| Affected Puppet version: | 0.25.4 | Branch: | ||
| Keywords: | syslog type | |||
| Votes: | 0 |
Description
Attached files for syslog type, needs tests written.
History
Updated by Luke Kanies almost 5 years ago
- Status changed from 1 to Closed
- 7 set to fixed
Added in r2748.
It’s easier if the files are provided as a single patch, btw.
Updated by Luke Kanies almost 5 years ago
- Status changed from Closed to 4
- 7 deleted (
fixed)
Hmmm, I added basic tests to this type, and it looks like the code needs some more work. I’ve removed it (in 2749], at least until these tests pass.
Updated by Luke Kanies over 4 years ago
What about the tests I provided? Have you updated those and do they pass now?
Updated by devdas - over 4 years ago
I am stuck with this bit:
# This writes one element of the syslog configuration file properly
# but does not deal well with multiple elements.
# provider/syslog/parsed.rb
require 'puppet/provider/parsedfile'
# The default target
# We should be able to override this by setting it explicitly in Facter
syslogfile = nil
case Facter.value(:syslogfile)
when nil:
syslogconf = '/etc/syslog.conf'
else
syslogconf = Facter.value(:syslogfile)
end
Puppet::Type.type(:syslog).provide(:parsed,
:parent => Puppet::Provider::ParsedFile,
:default_target => syslogconf,
:filetype => :flat
) do
text_line :comment, :match => /^#/
text_line :blank, :match => /^\s+/
syslog = record_line :parsed,:fields => %w{facility priority destination},
:match => %r{^(\w+)\.(\w+)\s+(.+)$}
class << syslog
def to_line(record)
Puppet.debug "Record in to_line is %s.%s\t\t\t\%s" % [record[:facility], record[:priority], record[:destination]]
str = ""
str += record[:facility] + '.' + record[:priority] + "\t\t\t" + record[:destination] + "\n"
end
def process(record)
# Puppet.debug "record in process is %s" %record
syslog = []
source, destination = record.split(/\s+/)
source.split(/;/).each do |logger|
facility, priority = logger.split(/\./)
log_record = {
:facility => facility,
:priority => priority,
:destination => destination,
}
syslog << log_record
Puppet.debug "Key in process is %s %s and %s" % [syslogr0[:facility], syslogr0[:priority], syslogr0[:destination]]
end
end
end
end
Updated by devdas - over 4 years ago
Replying to [comment:5 devdas]: Ugh, ignore that. Attaching file.
Updated by Redmine Admin almost 4 years ago
- Status changed from 4 to Accepted
Updated by James Turnbull over 3 years ago
- Affected Puppet version set to 0.24.4
Facter.syslogconf is that a custom fact you’ve written?
Updated by James Turnbull about 2 years ago
- Status changed from Accepted to Code Insufficient
- Assignee deleted (
Luke Kanies) - Affected Puppet version changed from 0.24.4 to 0.25.4
- Keywords set to syslog type
Updated by James Turnbull about 1 year ago
- Status changed from Code Insufficient to Investigating
Devdas – any chance you feel like pulling this into a cohesive branch on GitHub or the like and pushing it to the -dev list? I’d love to see this get some more life.