{"id":16288313,"url":"https://github.com/roaldnefs/shipment","last_synced_at":"2025-04-09T07:14:12.921Z","repository":{"id":114857093,"uuid":"135806721","full_name":"roaldnefs/shipment","owner":"roaldnefs","description":"Ship Python logging to your ELK Stack.","archived":false,"fork":false,"pushed_at":"2018-06-02T10:00:02.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T09:34:25.100Z","etag":null,"topics":["elk","logging","logstash","python","python3","redis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roaldnefs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"roaldnefs"}},"created_at":"2018-06-02T09:59:40.000Z","updated_at":"2018-06-02T10:02:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"36f334a8-0e41-4d91-a0c1-4c8781e496cb","html_url":"https://github.com/roaldnefs/shipment","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roaldnefs%2Fshipment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roaldnefs%2Fshipment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roaldnefs%2Fshipment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roaldnefs%2Fshipment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roaldnefs","download_url":"https://codeload.github.com/roaldnefs/shipment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247994122,"owners_count":21030049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elk","logging","logstash","python","python3","redis"],"created_at":"2024-10-10T19:47:55.230Z","updated_at":"2025-04-09T07:14:12.897Z","avatar_url":"https://github.com/roaldnefs.png","language":"Python","funding_links":["https://github.com/sponsors/roaldnefs"],"categories":[],"sub_categories":[],"readme":"# Shipment\n\nShip Python logging to your ELK Stack.\n\n## Installation\n\nUsing pip:\n\n```bash\npip install shipment\n```\n\n## Usage\n\nFor example:\n\n```python\nimport logging\nimport shipment\n\n\nhost = 'localhost'\n\n# Configure the logger and add a Logstash and Redis handler.\nlogger = logging.getLogger(__name__)\nlogger.setLevel(logging.INFO)\n#logger.addHandler(shipment.LogstashHandler(host, 5959))\nlogger.addHandler(shipment.RedisHandler('redis_test', host=host, port=6379, level=logging.DEBUG))\n\n# Send some logs.\nlogger.error('test logstash error message.')\nlogger.info('test logstash info message.')\nlogger.warning('test logstash warning message.')\n```\n\n## Using with Django\n\nModify your `settings.py` to integrate `shipment` with Django's logging:\n\n```python\nLOGGING = {\n  ...\n  'handlers': {\n      'logstash': {\n          'level': 'DEBUG',\n          'class': 'shipment.LogstashHandler',\n          'host': 'localhost',\n          'port': 5959, # Default value: 5959.\n          'formatter': 'shipment.LogstashFormatter', # Default value: 'shipment.LogstashFormatter'.\n          'message_type': 'logstash',  # 'type' field in logstash message. Default value: 'logstash'.\n          'fqdn': False, # Fully qualified domain name. Default value: False.\n          'tags': ['tag1', 'tag2'], # list of tags. Default: None.\n      },\n      'redis': {\n          'level': 'DEBUG',\n          'class': 'shipment.RedisHandler',\n          'host': 'localhost',\n          'port': 6379, # Default value: 6379.\n          'password': None, # Default value: None.\n          'formatter': 'shipment.LogstashFormatter', # Default value: 'shipment.LogstashFormatter'.\n          'message_type': 'redis', # 'type' field in logstash message. Default value: 'logstash'.\n          'fqdn': False, # Fully qualified domain name. Default value: False.\n          'tags': ['tag1', 'tag2'], # List of tags. Default: None.\n      },\n  },\n  'loggers': {\n      'django.request': {\n          'handlers': ['logstash', 'redis'],\n          'level': 'DEBUG',\n          'propagate': True,\n      },\n  },\n  ...\n}\n```\n\n## Example Logstash Configuration\n\nExample Logstash configuration (`logstash.conf`) for receiving evens from `shipment`:\n\n```bash\ninput {\n  tcp {\n    port  =\u003e 5959\n    codec =\u003e json\n  }\n  redis {\n    host      =\u003e 'redis'\n    port      =\u003e 6379\n    data_type =\u003e 'channel'\n    key       =\u003e 'redis_test'\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froaldnefs%2Fshipment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froaldnefs%2Fshipment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froaldnefs%2Fshipment/lists"}