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

 

Upgrade a server on an AWS EC2 instance with minimum risk and downtime

When you need to upgrade an application on an AWS EC2 instance with minimum downtime, there are many options.

Upgrade an EC2 instance

  1. Stop the application, so users don’t make more changes,
  2. Create a backup of the database (snapshot of the RDS instance),
  3. Create a backup of the server (backup image of the EC2 instance),
  4. Upgrade the application on the server,
  5. Start the application,
  6. Test the new version of the application.

In case the upgrade fails, or the post-upgrade test fails

  1. Stop the application,
  2. If you use RightScale to launch servers:
    1. stop the RightLink service on the failed server to prevent RightScale auto terminating the restored server
      (When RightScale finds a new identical server instance, it automatically shuts it down to avoid multiple instances with the same identifier.)
    2. Terminate the failed server
  3. Stop the failed server,
  4. Restore the database from the pre-upgrade backup with a new name,
  5. Restore the server instance from the pre-upgrade backup,
  6. Start the restored server,
  7. Change the database address in the application’s config file to point to the restored database,
  8. Start the application,
  9. Test the restored version of the application.

To make the backup image of the AWS EC2 instance

  1. Open the AWS console and navigate to EC2, Running instances
  2. Find the server instance you want to backup
  3. Right-click the row of the instance and select Image, Create Image

  4. Name the image and click the Create Image button
  5. Save the image Id from the popup

Test your RightScale script without creating unnecessary revisions

There are certain functions in RightScale scripts (RightScripts) that you cannot test without launching a new instance. To test your script:

  1. Edit the Head revision of the RightScale script and save it,
  2. Attach the Head revision of the RightScale script to the Head revision of the RightScale Server Template,
  3. In your Self Service CAT file reference revision 0 (zero) of the Server Template (Head revision),
    ( “server_template_revision”  => “0”, )
  4. Upload the Self Service CAT file to Self Service, but do not publish it,
  5. Launch a server instance from Self Service using the RightScale Self-Service Designer page, not the Catalog.

If the script has some errors, modify the Head revision of the RightScale script and launch a new server instance using the RightScale Self-Service Designer page.

When the script works perfectly:

  1. Commit the RightScale script, creating a new RightScale script revision,
  2. Attach the committed revision of the RightScale script to the Server Template’s Head revision,
  3. Commit the Server Template, creating a new Server Template revision,
  4. Publish the new revision of the Server Template,
  5. Reference the new revision of the Server Template in your Self Service CAT file.

Windows 10 can’t connect to this network

If your Windows 10 computer can successfully connect to some wireless networks, but cannot connect to certain wireless networks, it is possible, that the stored credentials are out of date. To force Windows 10 to ask you for the updated username and password

  1. In the Start Menu select Settings,
     
  2. On the Windows Settings page select Network & Internet,
  3. On the left side select Wi-Fi,
  4. On the Wi-Fi page select Manage known networks,
  5. Select the network you are not able to connect and click the Forget button,
  6. In the lower right corner of the screen select the Wi-Fi network icon, select the network, and click the Connect button.

 

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.

The User Profile Service failed the sign-in. User profile cannot be loaded.

When you try to start a remote desktop connection to a Windows computer on the domain you may get the error message:

The User Profile Service failed the sign-in. User profile cannot be loaded.

To enable the User Profile update

  1. Remote into the computer with a local administrator account,
  2. In Windows Explorer open the C:\Users\Default\AppData folder,
  3. Right click the Roaming folder and select Properties,
  4. On the Security tab click the Advanced button,
  5. In the Permission entries list select System,
  6. Check the Replace all child object permissions… check box,
  7. Click the OK button,
  8. Click the Yes button on the Windows Security popup,
  9. Close the Properties window with the OK button.

Manage Windows Backups

To manage the Microsoft Windows Backups you can use a command line tool.

Open a command prompt as administrator

Show the existing backup versions

Wbadmin get versions

Clean up the backup disk

To keep a number of latest backups and delete the rest

Wbadmin delete backup -keepversions:NUMBER_OF_BACKUPS_TO KEEP

To keep the latest backup only

Wbadmin delete backup -keepversions:1

To delete all existing backups

Wbadmin delete backup -keepversions:0

 

Second monitor does not work on Toshiba P-70A in Windows 10

Since I installed Windows 10 on my Toshiba P-70A laptop, the computer does not recognize the second monitor.

To make the second monitor work, I had to uninstall the display drivers and remove them from the computer:

  1. Open the File Explorer
  2. Right click This PC and select Properties
  3. In the upper left corner select Device Manager
  4. Expand the Display adapters section
  5. Right click each display adapter,
    1. Select Uninstall
    2. Check  Delete the driver software for this device
  6. The computer will reboot.

To keep your second monitor working do not update the display drivers, keep the drivers that Windows installs during the reboot.

Chef file locations

When the Chef cookbook is tested in Test Kitchen

The .kitchen.yml file contains the username to run the Chef cookbook. It is specified under platforms:, transport:, username:

Use that value in place of USER_NAME_FROM_KITCHEN_YML below

Cookbook location

When the Chef recipes are executed, all cookbooks are stored on the node. You can examine the code to make sure your latest changes are reflected on the machine.

On Linux

/var/chef/cache/cookbooks

On Linux under Test Kitchen

/tmp/kitchen/cookbooks and
/tmp/kitchen/cache/cookbooks

On Windows

C:\chef\cache\cookbooks

On Windows under Test Kitchen

C:\Users\USER_NAME_FROM_KITCHEN_YML\AppData\Local\Temp\kitchen\cookbooks

 

The log of the Chef client run

The output of the Chef cookbook execution is in the chef.log or chef-client.log file

On Linux

/var/log/chef.log

On Windows

The log of the first Chef Client run. The log entries of the initial Chef Client run are saved here.

C:\chef\chef-client.log

The log of subsequent Chef Client runs. After the initial Chef Client run, the rest of the log entries are collected in this file.

C:\chef\log\client.log

Stacktrace

Chef saves information on the hard drive when scripts are executed. If there is a failure, the stack trace of the last error is saved in the chef-stacktrace.out file.

On Linux

/var/chef/cache/chef-stacktrace.out

On Linux under Test Kitchen

/tmp/kitchen/cache/chef-stacktrace.out

On Windows

C:\chef\cache\chef-stacktrace.out

On Windows under Test Kitchen

C:\Users\USER_NAME_FROM_KITCHEN_YML\AppData\Local\Temp\kitchen\cache\chef-stacktrace.out

Ohai output

All the information that Ohai collects on the instance, is saved in the failed-run-data.json file, even if there is no error. It is a great resource to find get

Cloud info

  • cloud-specific information under “cloud
  • cloud instance information under “ec2

Computer info

  • CPU and memory configuration under “cpu“, “cs_info“, “memory
  • drive sizes and network settings under “filesystem” and “network

Operating system info

  • operating system information under “os_info
  • list of enabled Windows features under “dism_features
  • the list of installed applications under “packages

Chef info

  • Chef client configuration values under “chef_client
  • the Chef node information under “chef_type”: “node
  • the Chef run list under “run_list
  • list of Chef cookbooks and their versions under “cookbooks
  • list of the executed recipes under “recipes
  • the value of the passed in Chef attributes under “normal
  • the value of the Chef cookbook attributes under “chef_client” and the cookbook name
  • all the information on the Chef resources under “json_class
  • the stack trace of the last error under “exception

On Linux

/var/chef/cache/failed-run-data.json

On Linux under Test Kitchen

/tmp/kitchen/cache/failed-run-data.json

On Windows

C:\chef\cache\failed-run-data.json

On Windows under Test Kitchen

C:\Users\USER_NAME_FROM_KITCHEN_YML\AppData\Local\Temp\kitchen\cache\failed-run-data.json

Data Bags

On Linux under Test Kitchen

/tmp/kitchen/data_bags

On Windows under Test Kitchen

C:\Users\USER_NAME_FROM_KITCHEN_YML\AppData\Local\Temp\kitchen\data_bags