Skip to main content

Upload scrapy logs to S3

Project description

Scrapy S3 Log Storage

DEPRECATED

This package is deprecated. Please use scrapy-logexport instead.

Description

A Scrapy extension to upload log files to S3.

If you're already exporting your feeds to S3 this extension uses many of the same settings. After adding this extension to your EXTENSIONS setting, just set the LOG_FILE, S3_LOG_BUCKET and an optional S3_LOG_ACLsettings and you're good to go.

Installation

You can install scrapy-s3logstorage using pip:

    pip install scrapy-s3logstorage

Configuration

This extension still requires that a local log file is written. Once scrapy's engine has stopped, the extension will upload the log file to S3 and optionally delete the local file.

Enable the extension by adding it to your settings.py:

    from environs import Env

    env = Env()  
    env.read_env() 

    EXTENSIONS = {
        'scrapy_s3logstorage.extension.S3LogStorage': 0,
    }

    LOG_FILE = 'scrapy.log' # Must be a local file
    S3_LOG_BUCKET = 'my-bucket' # Bucket name to store logs
    S3_LOG_DELETE_LOCAL = True # Delete local log file after upload, defaults to False

    # If AWS CLI is configured, and you're using the same credentials the following settings are optional
    AWS_ACCESS_KEY_ID = env("AWS_ACCESS_KEY_ID")
    AWS_SECRET_ACCESS_KEY = env("AWS_SECRET_ACCESS_KEY")
    AWS_SESSION_TOKEN = env("AWS_SESSION_TOKEN") # if required
    AWS_ENDPOINT_URL = None  # or your endpoint URL

    # S3_LOG_ACL takes priority over FEED_STORAGE_S3_ACL.
    # If S3_LOG_ACL is not set, FEED_STORAGE_S3_ACL will be used.
    # Setting one or both of these settings is optional.

    S3_LOG_ACL = ''  # or other S3 ACL
    FEED_STORAGE_S3_ACL = '' # or other S3 ACL

Project details


Download files

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

Source Distribution

scrapy_s3logstorage-0.1.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

scrapy_s3logstorage-0.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file scrapy_s3logstorage-0.1.1.tar.gz.

File metadata

  • Download URL: scrapy_s3logstorage-0.1.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.19.0-43-generic

File hashes

Hashes for scrapy_s3logstorage-0.1.1.tar.gz
Algorithm Hash digest
SHA256 22d913b0375dcaf4d8fabea5e7be5a5a729ad560d06e5850e0ed82e17312bb13
MD5 fc7b82c3e554f4ef5a2528deb0387c88
BLAKE2b-256 2136af70d56e7d5e79e6904b5def4d09af7e4393a93f2db9a25e5e0476843d2f

See more details on using hashes here.

File details

Details for the file scrapy_s3logstorage-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for scrapy_s3logstorage-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3fe611bb12117e90b17e2000978c57a1bd919ff4873e9277f77283ed5122b1a0
MD5 776a43d87868639996d92ed1cbf1746d
BLAKE2b-256 ee3218c393d73997b01b1e0151542f907aade1a413114cf82d30a2feb1b1b765

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