Skip to content

Instantly share code, notes, and snippets.

@hermes-pimentel
hermes-pimentel / msk-servicediscovery-http.py
Last active January 9, 2023 22:17
msk-servicediscovery-http.py
import json
import boto3
from functools import reduce
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
client = boto3.client('kafka')
@hermes-pimentel
hermes-pimentel / msk-lambda-firehose-transform-logs-to-opensearch.py
Last active April 18, 2023 19:33
msk-lambda-firehose-transform-logs-to-opensearch.py
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
#!/bin/bash
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS

Keybase proof

I hereby claim:

  • I am hermes-pimentel on github.
  • I am hermespimentel (https://keybase.io/hermespimentel) on keybase.
  • I have a public key ASA971Ff9OF6C8RkieT5V_AjY-yCKihJJsC-yu2xjVtxlAo

To claim this, I am signing this object:

#!/usr/bin/env python3
'''
This script sets a retention on all the logGroups that don't have one set
'''
import boto3
import logging
# Retention it will be set to
RETENTION = 30
@hermes-pimentel
hermes-pimentel / README.md
Created April 3, 2018 05:27 — forked from guillaumevincent/README.md
Windows Service with Python 3.5 and pyinstaller
@hermes-pimentel
hermes-pimentel / jupyter_notebook_ngnix_proxy.txt
Last active September 16, 2017 15:13
Jupyter Notebook Ngnix Proxy Config Working.
# Jupyter configuration #
c.NotebookApp.open_browser = False
c.NotebookApp.port = 9090
c.NotebookApp.password = u'sha1:somepass'
c.Authenticator.admin_users = {'hadoop'}
c.LocalAuthenticator.create_system_users = True
c.NotebookApp.contents_manager_class = 's3contents.S3ContentsManager'
c.S3ContentsManager.bucket_name = 'my-bucket'
c.S3ContentsManager.prefix = 'notebooks'
@hermes-pimentel
hermes-pimentel / bootstrap_jupyter.sh
Created September 12, 2017 17:30 — forked from nicor88/bootstrap_jupyter.sh
Bootstrap action to install Conda and Jupyter on EMR
#!/usr/bin/env bash
set -x -e
JUPYTER_PASSWORD=${1:-"myJupyterPassword"}
NOTEBOOK_DIR=${2:-"s3://myS3Bucket/notebooks/"}
# home backup
if [ ! -d /mnt/home_backup ]; then
sudo mkdir /mnt/home_backup
sudo cp -a /home/* /mnt/home_backup
@hermes-pimentel
hermes-pimentel / gist:7d8a542e50d2d455c1d3c5b58f9ec2f8
Created September 6, 2017 23:25 — forked from keithchambers/gist:80b60559ad83cebf1672
Ansible role to set 'noop' i/o scheduler (CentOS 7)
---
- name: test if grub configured for noop i/o scheduler
command: egrep -q 'elevator=noop' /boot/grub2/grub.cfg
register: grub
changed_when: no
failed_when: grub_test.rc == 2
- name: configure grub for noop i/o scheduler
sudo: yes
command: grubby --update-kernel=ALL --args=elevator=noop
journalctl
This will display the logs with the oldest entries first. Although this is simple, it is not very useful since we do not tend to read logs like a book.
By default journalctl displays the logs in a pager. It shows you one page of logs requiring you to hit the space bar to proceed. Also long log lines WILL NOT wrap, they will trail off the right side of the screen. You can use the right arrow to see the rest of the line.
We will talk more about changing the way the logs are displayed in a different article. Let's move on to some basic log viewing commands.
Diplaying Logs by Date