Splunk installation

Install Splunk

  1. Navigate to the Splunk website at splunk.com,
  2. In the upper right corner select the Free Splunk button,
  3. If you don’t yet have a Splunk account, register to create one, otherwise log in,
  4. Select the Free Download in the Splunk Enterprise frame,
  5. Select the tab with the operating system of your machine.

Linux

  1. The simplest way to install Splunk on Linux is with wget in the command line. Click the Download via Command Line (wget) in the upper right corner in the Useful Tools box.
  2. Copy the command to your clipboard from the popup window,
  3. Execute the wget command in a terminal window to download the tar archive,
  4. It is recommended to install Splunk in the opt directory, untar the archive there.
    sudo tar xvzf splunk.tgz –C /opt

Windows

  1. Download the .msi installer for your operating system (32 bit or 64 bit),
  2. Run the installer, follow the prompts, and accept the license agreement,
  3. Use Local System to run Splunk under.

Macintosh OSX

  1. Select the .dmg installer for simpler installation,
  2. Follow the prompts to install the application,
  3. At the end of the installation select Start and Show Splunk to start the application and view the user interface in a browser.

 

To start, stop, and administer Splunk

Linux

  1. In a terminal window navigate to the Splunk bin directory
    cd /opt/splunk/bin
  2. To Start Splunk and accept the license agreement during the first start
    ./splunk start --accept-license
  3. The terminal window displays the Splunk web interface address in the The Splunk web interface is at … line. Open a browser to navigate to the address.
  4. To start, stop, and restart the instance, and get help execute
    ./splunk start
    ./splunk stop
    ./splunk restart
    ./splunk help

Macintosh OSX

  1. In a terminal window navigate to the Splunk bin directory
    cd /Applications/Splunk/bin
  2. To start, stop, and restart the instance, and get help execute
    ./splunk start
    ./splunk stop
    ./splunk restart
    ./splunk help

Logging into Splunk the first time

The initial credentials after installation is
Username: admin
Password; changeme

 

Send CTRL-ALT-DELETE a Windows Virtual Box computer from a Macintosh

When you start a Windows 7 or equivalent server machine, to log in, you need to press CTRL-ALT-DELETE on the keyboard to get the login page. To send Control-Alt-Delete to a Windows virtual machine in Virtual Box from a Macintosh

on a Macintosh laptop press the fn – Command  – Delete back  keys

on a Macintosh desktop press the Command  – Delete forward  keys.

Native resolution in Remote Desktop client on MacOSX

When you connect to a Windows computer from your Macintosh workstation the best remote desktop client is the Microsoft Remote Desktop app from the Apple Appstore.

To configure the remote desktop connection for the best experience

  1. Select Native resolution
  2. Scale content for Full screen mode
    To be able to unselect the “Use all monitors checkbox”, uncheck it first, before you uncheck the “Start session in full screen” checkbox, otherwise, the last checkbox will be disabled.

If you use multiple displays, make sure you open the Microsoft Remote Desktop app on the display you want to use to view the remote computer, because the Native resolution setting will use the resolution of the display the app is running on at the moment you start the remote desktop connection.

How to move a window on the Macintosh if the header is not visible

There are times when a window opens on your Mac and the header is out of the screen or hiding behind the Macintosh Toolbar.

To move the entire window back to the screen try to find a point on the edge that instead of stretches the window, moves it. Four small regions on the sides can move the window up and down, another two small regions at the bottom can move the window sideways. The locations of the regions are very inconsistent, in one moment they work, a second later the region is at another location.

 

Custom Git Status and Git Pull commands to work with all of your repositories

If you work with many Git repositories it is easy to miss a repository when you commit your changes, and very time consuming to pull from all repositories.

It is easy to automate both processes.

In this example, we will place all files in the ~/Git/devops-scripts folder. If you want to place your files at another location change it in the files below.


\/  \/  \/  \/  \/  \/  \/  \/  \/  \/

In Windows

To find your home directory on a Windows workstation, open a Bash window (Git Bash) and execute

echo ~

/\  /\  /\  /\  /\  /\  /\  /\  /\  /\


Create the Bash script files

  • Create a file with the list of Git repositories and save it as ~/Git/devops-scripts/git-repositories.txt
    You can separate groups of repositories with empty lines.
~/Git/MY_REPO1
~/Git/MY_REPO2

~/Git/MY_REPO3
~/Git/MY_REPO4
  • Create a file to check the status of all Git repositories and save it as ~/Git/devops-scripts/git-status.sh
#!/bin/bash
input="$HOME/Git/devops-scripts/git-repositories.txt" # Use $HOME instead of ~ to refer to the home directory. The Bash loop cannot interpret ~ as the home directory

RED='\033[0;31m'
NC='\033[0m' # No Color

while IFS= read -r folder
do

 # Get the length of the path
 # On Windows the empty line manifests itself as a 1 character long not empty string 
 path_length=${#folder}

 if [[ ( -n "$folder" ) ]] && [[ ( 1 < $path_length ) ]] ; then
 # The path is not empty and the length is greater than 1

 eval cd $folder # Need EVAL, otherwise CD does not work if the path contains ~
 pwd | tr -d '\n'

 status=$(git status)

 # --------------------------------------------------------------------------
 # To handle

 # On branch master
 # Your branch is up-to-date with 'origin/master'.
 # Untracked files:
 # (use "git add <file>..." to include in what will be committed)

 if [[ $status == *"Untracked files"* ]]; then
 echo -e " ---- ${RED}New files added, please ADD${NC}" | tr -d '\n' # -e tells echo to enable backslash escapes
 fi

 # --------------------------------------------------------------------------
 # To handle

 # On branch master
 # Your branch is up-to-date with 'origin/master'.
 # Changes not staged for commit:
 # (use "git add <file>..." to update what will be committed)
 # (use "git checkout -- <file>..." to discard changes in working directory)

 if [[ $status == *"Changes not staged for commit"* ]]; then
 echo -e " ---- ${RED}Files changed, please ADD${NC}" | tr -d '\n' # -e tells echo to enable backslash escapes
 fi

 # --------------------------------------------------------------------------
 # To handle

 # On branch master
 # Your branch is up-to-date with 'origin/master'.
 # Changes to be committed:
 # (use "git reset HEAD <file>..." to unstage)

 if [[ $status == *"Changes to be committed"* ]]; then
 echo -e " ---- ${RED}Please COMMIT${NC}" | tr -d '\n' # -e tells echo to enable backslash escapes
 fi

 # --------------------------------------------------------------------------
 # To handle

 # On branch master
 # Your branch is ahead of 'origin/master' by 1 commit.
 # (use "git push" to publish your local commits)
 # nothing to commit, working tree clean

 if [[ $status == *"git push"* ]]; then
 echo -e " ---- ${RED}Please PUSH${NC}" | tr -d '\n' # -e tells echo to enable backslash escapes
 fi

 # --------------------------------------------------------------------------
 # To handle

 # On branch master
 # Your branch and 'origin/master' have diverged,
 # and have 1 and 1 different commits each, respectively.
 # (use "git pull" to merge the remote branch into yours)
 # nothing to commit, working tree clean

 if [[ $status == *"git pull"* ]]; then
 echo -e " ---- ${RED}Repos diverged, PULL to merge${NC}" | tr -d '\n' # -e tells echo to enable backslash escapes
 fi

 # --------------------------------------------------------------------------

 echo

 fi
done < "$input"

  • Create a file to pull from all Git repositories and save it as ~/Git/devops-scripts/git-pull.sh
#!/bin/bash
input="$HOME/Git/devops-scripts/git-repositories.txt" # Use $HOME instead of ~ to refer to the home directory. The Bash loop cannot interpret ~ as the home directory

while IFS= read -r folder
do

 # Get the length of the path
 # On Windows the empty line manifests itself as a 1 character long not empty string 
 path_length=${#folder}

 if [[ ( -n "$folder" ) ]] && [[ ( 1 < $path_length ) ]] ; then
 # The path is not empty and the length is greater than 1

 eval cd $folder # Need EVAL, otherwise CD does not work if the path contains ~
 pwd
 git pull

 fi

done < "$input"

Enable the script execution


\/  \/  \/  \/  \/  \/  \/  \/  \/  \/

 In Mac OS

  • Open a terminal window in the ~/Git/devops-scripts folder
  • Run these commands to enable the execution of the Bash files
chmod u+x git-status.sh
chmod u+x git-pull.sh

/\  /\  /\  /\  /\  /\  /\  /\  /\  /\


Create an alias

Aliases allow you to execute commands from any folder in the command line and hide the complexity of the entire command.


\/  \/  \/  \/  \/  \/  \/  \/  \/  \/

In Mac OS

If you use the iTerm terminal window

iTerm reads the configuration settings from the~/.zshrc file. If you use iTerm add the alias definitions to the end of the ~/.zshrc file.

  • Open the~/.zshrc file and add the lines below to the end of it
If you use the built-in OSX Terminal

The built-in Terminal windows reads the configuration settings from the~/.bash_profile file.

  • Open the ~/.bash_profile file and add the lines below to it

In Windows

If you use Git Bash
  • Navigate to your home directory ( cd ~ )
  • Create the Bash config file if does not exist
    cp > ~/.bashrc

    Bash will show an error message, but it will create the file that you can edit with any text editor

  • Add the lines below to the file

/\  /\  /\  /\  /\  /\  /\  /\  /\  /\


 

alias status='~/Git/devops-scripts/git-status.sh'
alias pull='~/Git/devops-scripts/git-pull.sh'

Refresh the settings in the Bash shell environment


\/  \/  \/  \/  \/  \/  \/  \/  \/  \/

In MacOS

source ~/.bash_profile

In Windows

Close the Bash window and open it again

/\  /\  /\  /\  /\  /\  /\  /\  /\  /\


How to use it

Open a terminal window in any folder

To check if you need to add, commit or push files in a Git repository:

status

If you have added new files to the repository you get:

/Users/YOUR_USER_NAME/Git/devops-scripts —- New files added, please ADD

If you have changed files in a Git repository you get:

/Users/YOUR_USER_NAME/Git/devops-scripts —- Files changed, please ADD

If you have already executed the git add . command, but have not yet committed the changes:

/Users/YOUR_USER_NAME/Git/devops-scripts—- Please COMMIT

If you have already committed the changes, but have not pushed the to the remote repository:

/Users/YOUR_USER_NAME/Git/devops-scripts —- Please PUSH

To pull from every Git repository before you start to work

pull

 

 

How to verify or generate file checksums

You can verify the checksum of a file with the built-in features of the operating systems

On Macintosh and Linux

Open the terminal window and execute the commands

SHA-256

shasum -a 256 FILE_NAME

On Windows

CRC32, CRC64, SHA256, SHA1, BLAKE2sp

Right-click the file in Windows Explorer and select CRC SHA > * (star)

The popup window will show the values, but unfortunately, there is no way to copy them to the clipboard. To be able to copy the hash value to the clipboard open a Bash window on the Windows computer and execute the Macintosh/Linux commands above.

To install Bash on a Windows workstation see the Git section of Install the DevOps development tools on Windows.

Bluetooth Not Available in Sierra on the Macintosh

Multiple time, after a software update on my Macintosh, the “Bluetooth Not Available” message showed in the toolbar, so I could not use my wireless mouse anymore.

There are two recommended actions we can take to bring Bluetooth back to life. If the first one does not help, try to execute them together during the same shutdown and restart cycle.

Delete the com.apple.Bluetooth.plist file from Library / Preferences

  1. Start Finder,
  2. In the Go menu select Go to Folder,
  3. Enter /Library/Preferences into the text box and click the Go button,
  4. Delete the com.apple.Bluetooth.plist file,
  5. Shut down the Macintosh,
  6. Start the computer again.

Reset the SMC to reinitialize the Bluetooth module

  1. Shut down the Macintosh,
  2. Disconnect all peripherals (external display, drives, mouse, printer),
  3. Make sure the power adapter is connected to the computer,
  4. Press and hold the Shift, Control and Option buttons for 10 seconds,
  5. Start the computer with the power button, with the peripherals still disconnected,
  6. Re-connect the peripherals.

Recommended utilities for your workstation

Graphics

Snagit

Snagit is a great utility to capture screens and annotate them for documentation. The program is available for Mac and Windows.

Download the latest version at https://www.techsmith.com/

Get older versions at https://www.techsmith.com/download/oldversions

Terminal emulator

PuTTY

Install PuTTY

On Macintosh

  1. Open a terminal window
  2. Install PuTTY with Homebrew. For the Homebrew installation see the Homebrew section of Install the DevOps development tools on Macintosh
    brew install putty

On Windows

  1. Download the MSI (‘Windows Installer’) of PuTTY from https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html,
  2. Execute the MSI installer.