Skip to main content

Python Logger for Logging Data on Amazon CloudSearch

Project description

PyPI Version

CloudSearch-Logger

This module helps you in logging data on amazon cloudsearch server using python logger.

Installing

When pip is available, the distribution can be downloaded from PyPI and installed in single step

Pip:

pip install cloudsearch-logger

or you can use easy_install

Easy Install:

easy_install cloudsearch-logger

Manual:

python setup.py install

Usage

You can use this cloudsearch logger in python scripting code and in django web application as well.

Example1

import logging
import uuid

from cloudsearch_logger import CloudSearchHandler

test_logger = logging.getLogger('python-cloudsearch-logger')
test_logger.setLevel(logging.INFO)
test_logger.addHandler(CloudSearchHandler(
    domain='domain-name',
    region='us-east-1',
    aws_access_key_id='aws-access-key-id',
    aws_secret_access_key='aws-access-secret-key'))

data = dict(_document_id=str(uuid.uuid4()), ...)

test_logger.info(data)

Using with Django

Modify your settings.py file to integrate cloudsearch-logger with Django’s logging:

LOGGING = {
  ...
  'handlers': {
      'cloudsearch': {
          'level': 'INFO',
          'class': 'cloudsearch_logger.CloudSearchHandler',
          'domain': 'domain-name',
          'region': 'us-east-1',  # Default value: us-east-1
          'aws_secret_access_key': 'aws-access-secret-key',
          'aws_access_key_id': 'aws-access-key-id'
      },
  },
  'loggers': {
      'django.request': {
          'handlers': ['cloudsearch'],
          'level': 'INFO',
          'propagate': True,
      },
  },
  ...
}

You can find more examples in the example1.py and example2.py files.

Project details


Release history Release notifications | RSS feed

This version

0.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

CloudSearch-Logger-0.2.tar.gz (5.0 kB view details)

Uploaded Source

File details

Details for the file CloudSearch-Logger-0.2.tar.gz.

File metadata

File hashes

Hashes for CloudSearch-Logger-0.2.tar.gz
Algorithm Hash digest
SHA256 67955d352277091ed9968b88383b028d2f7c389db0e92e96025bf4203d96b94b
MD5 4bbb3fdbe2b9eb4a4a7db49b13632c0c
BLAKE2b-256 acdc14e94252414a954795ca2f08559b9e25e39c52e241b8d942b387d6c5a4e5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page