• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » How To Process Server Log in Hadoop, Pig : Free IBM Analytics Demo Cloud

By Abhishek Ghosh July 20, 2017 11:02 pm Updated on September 17, 2017

How To Process Server Log in Hadoop, Pig : Free IBM Analytics Demo Cloud

Advertisement

In our previously published guides, we talked about installing Hadoop, installing Pig on own server. We also talked about free IBM Analytics Demo Cloud with needed softwares pre-installed, ready to use. Here is basic example with commands to show how to process server log in Hadoop, Pig can be done using free IBM Analytics Demo Cloud. This guide can be followed by even who never used Hadoop or Pig. We collected a script for the easy work. We only can not supply our server log to you as IP address collected by our server is sensitive data and may be prohibited to share in EU countries to protect privacy of our readers. You need to collect Apache web server access log from somewhere to really follow this guide.

 

How To Process Server Log in Hadoop, Pig

 

First, SSH to IBM Analytics Demo Cloud. Then wget your access log file in your desired location, for us location is ~ aka $HOME aka where you’ll be after login via SSH. In our example, the access log file’s name is access.log.1.

In case you are on SSH of your server, then use CLI FTP commands to upload (commands are under the sub header “Transfer FTP Files Directly From One Server to Another : Major Methods With Command Line”) the log to IBM Analytics Demo Cloud instance.

Advertisement

---

First we are feeding the data to Hadoop with this command :

Vim
1
hadoop fs -put access.log.1

If you face error, append location where diskX is disk number like disk2, USERNAME is like admin1234 (which IBM Analytics Demo Cloud provided you to SSH) :

Vim
1
hadoop fs -put access.log.1 /diskX/home/USERNAME/

If you run this command :

Vim
1
hadoop fs -ls -R

You’ll get output like this where you’ll find your thing listed :

Vim
1
2
drwx------+  - USERNAME USERNAME          0 2017-07-20 17:04 .staging
-rw-rw----+  3 USERNAME USERNAME  12183708 2017-07-20 16:33 access.log.1

Now we will create a script named script.pig at the same location with this content :

Vim
1
2
3
4
5
6
7
8
9
DEFINE ApacheCommonLogLoader org.apache.pig.piggybank.storage.apachelog.CommonLogLoader();
 
logs = LOAD '/path/to/USERNAMER/access.log.1' USING ApacheCommonLogLoader AS (addr: chararray, logname: chararray, user: chararray, time: chararray, method: chararray, uri: chararray, proto: chararray, status: int, bytes: int);
 
addrs = GROUP logs BY addr;
 
counts = FOREACH addrs GENERATE flatten($0), COUNT($1) as count;
 
DUMP counts;

Change /path/to/USERNAMER/access.log.1 in the above example to real path and save the file. Now run this command :

Vim
1
locate piggybank.jar

You will get a list of paths. At the bottom of the list, there will be entries like :

Vim
1
2
3
4
5
...
/usr/ibmpacks/bigsheets/5.4/libext/piggybank.jar
/usr/iop/4.1.0.0/hive/lib/piggybank.jar
/usr/iop/4.1.0.0/pig/piggybank.jar
/usr/iop/4.1.0.0/pig/lib/piggybank.jar

We will use that /usr/iop/4.1.0.0/pig/piggybank.jar path. Run :

Vim
1
pig

You will get MySQL like interface :

Vim
1
grunt>

Run this command there :

Vim
1
REGISTER '/usr/iop/4.1.0.0/pig/piggybank.jar';

To exit the interface, run :

Vim
1
quit

Now run :

Vim
1
pig -x local script.pig

With the script, you’ll get output of list of IP like this :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
...
(97.88.119.105,1)
(103.73.224.177,2)
(112.134.38.209,12)
(112.215.240.56,1)
(112.76.230.153,1)
(115.64.142.113,1)
(117.202.230.80,1)
(118.163.69.237,1)
(118.71.254.244,1)
(120.188.87.203,2)
...

How To Process Server Log in Hadoop, Pig - Free IBM Analytics Demo Cloud

Notice the above syntax – IP followed by number of times separated by comma. That is what was intended to show you a basic demo.

Tagged With IBM Analytics Demo Cloud , how to stop process in pig hadoop , pig hive , Raspberry Pi Car PC System

This Article Has Been Shared 452 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Orthopaedic Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How To Process Server Log in Hadoop, Pig : Free IBM Analytics Demo Cloud

  • Cloud Computing – Risks of Free Public Cloud you are using

    Cloud Computing, specially the free public cloud computing has potential risks. Most users are not even aware that they are actually using Cloud Computing.

  • OpenNebula : Open Source Cloud Management Platform

    OpenNebula is an Open Source Cloud Management Platform which provides cloud toolkit for managing specifically the distributed data center infrastructures.

  • How to embrace the Cloud Computing Concept Properly ?

    How to embrace the Cloud Computing Concept Properly is a Big Question stating from the developers to the managing director of a medium sized company.

  • OpenStack Marconi : Basic Guide For Cloud Queue

    OpenStack Marconi and Zaqar is a multi-tenant cloud messaging service. It has semantics to support event broadcasting and has RESTful API.

  • Install RVM on Rackspace Cloud Server (Ubuntu, PVHVM)

    Here is a step by step guide for the beginners on how to install RVM on Rackspace Cloud Server running Ubuntu 14.04, PVHVM version for Rails.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

You can subscribe to our Free Once a Day, Regular Newsletter by clicking the subscribe button below.

Click To Subscribe

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (21K Followers)
  • Twitter (5.3k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • 5 Sectors That Have Undergone Revamps in Digital Landscape February 24, 2021
  • What You Can Control with a Smartwatch and ESP32 February 23, 2021
  • What Does Data Cleansing Mean? February 21, 2021
  • How to Find the Right Software for Your Company February 20, 2021
  • What is Code Refactoring? February 19, 2021

 

About This Article

Cite this article as: Abhishek Ghosh, "How To Process Server Log in Hadoop, Pig : Free IBM Analytics Demo Cloud," in The Customize Windows, July 20, 2017, February 25, 2021, https://thecustomizewindows.com/2017/07/how-to-process-server-log-in-hadoop-pig-free-ibm-analytics-demo-cloud/.

Source:The Customize Windows, JiMA.in

 

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Cookie Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2021 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy