Skip to content

Instantly share code, notes, and snippets.

View bryanbarnard's full-sized avatar
🕶️
building

Bryan Barnard bryanbarnard

🕶️
building
View GitHub Profile
@adam-hanna
adam-hanna / systemd-cloudwatch-logs-tutorial.md
Last active April 24, 2024 03:22
Forward systemd service logs to AWS Cloudwatch

Introduction

I often find myself ssh'ing into my servers and checking my systemd service logs with $ journalctl -f -u {name}.service. One day I got tired of this and wanted all of my important logs in once place (Amazon AWS Cloudwatch). To my dismay, there weren't any real good tutorials on how to do so. So, voilà.

Steps

Overall, it's a fairly simple process consisting of the following few steps.

1. Modify the service file

Open the service file with $ sudo vi /lib/systemd/system/{name}.service

Modify the [Service] section:

@bryanbarnard
bryanbarnard / servicenow_sample_http_request.js
Created March 8, 2016 17:51
sample http request in servicenow using RESTMessageV2 server side api tested running in ServiceNow Geneva Release as a background script in global scope
/**
* sample http request in servicenow using RESTMessageV2 server side api
* tested running in ServiceNow Geneva Release as a background script in global scope
*/
(function sample_http_request() {
try {
var request = new sn_ws.RESTMessageV2();
request.setHttpMethod('get');
request.setEndpoint('https://api.myjson.com/bins/4j985');
@paulsena
paulsena / SFTP Client.js
Last active April 16, 2024 14:04
ServiceNow SFTP / SSH Javascript Client
var Sftp = Class.create();
Sftp.prototype = {
initialize: function() {
gs.print("Setting up SSH client.");
this.dataSourceID = '';
this.hostname = '';
this.port = 22;
this.username = '';
this.password = '';