The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Feature #745

Syslog type support

Added by devdas - about 7 years ago. Updated over 3 years ago.

Status:InvestigatingStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:newfeature
Target version:-
Affected Puppet version:0.25.4 Branch:
Keywords:syslog type

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket may be automatically exported to the PUP project on JIRA using the button below:


Description

Attached files for syslog type, needs tests written.

syslog.rb Magnifier (626 Bytes) devdas -, 08/01/2007 04:50 pm

basic-syslog-tests.patch Magnifier (1.51 KB) Luke Kanies, 08/05/2007 09:11 pm

syslog.diff Magnifier (2.71 KB) devdas -, 08/07/2007 04:32 pm

parsed.rb Magnifier (1.34 KB) devdas -, 11/26/2007 11:41 am

History

#1 Updated by devdas - almost 7 years ago

Replying to [comment:5 devdas]: Ugh, ignore that. Attaching file.

#2 Updated by Luke Kanies about 7 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.

#3 Updated by Luke Kanies about 7 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.

#4 Updated by Luke Kanies almost 7 years ago

What about the tests I provided? Have you updated those and do they pass now?

#5 Updated by devdas - almost 7 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


#6 Updated by Redmine Admin about 6 years ago

  • Status changed from 4 to Accepted

#7 Updated by James Turnbull about 6 years ago

  • Affected Puppet version set to 0.24.4

Facter.syslogconf is that a custom fact you’ve written?

#8 Updated by James Turnbull over 4 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

#9 Updated by James Turnbull over 3 years 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.

Also available in: Atom PDF