Exemple #1
0
    def _record(serial_number,
                time_stamp,
                host,
                attributes,
                attribute_names,
                encoder,
                condensed=False):

        if condensed is False:
            raw = encoder.encode(attributes)
        # Formulate record
        fields = dict()
        for f in attribute_names:
            if f in attributes:
                fields[f] = attributes[f]

        if serial_number > 0:
            fields['_serial'] = serial_number
            fields['_time'] = time_stamp
            if condensed is False:
                fields['_raw'] = raw
            fields['host'] = host
            return fields

        if condensed is False:
            record = OrderedDict(
                chain((('_serial', serial_number), ('_time', time_stamp),
                       ('_raw', raw), ('host', host)),
                      map(lambda name: (name, fields.get(name, '')),
                          attribute_names)))
        else:
            record = OrderedDict(
                chain((('_serial', serial_number), ('_time', time_stamp),
                       ('host', host)),
                      map(lambda name: (name, fields.get(name, '')),
                          attribute_names)))

        return record
Exemple #2
0
# Copyright 2011-2015 Splunk, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"): you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Python library for Splunk."""

from __future__ import absolute_import
from splunklib.six.moves import map
__version_info__ = (1, 6, 14)
__version__ = ".".join(map(str, __version_info__))
Exemple #3
0
# Copyright 2011-2015 Splunk, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"): you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

"""Python library for Splunk."""

from __future__ import absolute_import
from splunklib.six.moves import map
__version_info__ = (1, 6, 4)
__version__ = ".".join(map(str, __version_info__))