• 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
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, 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

  • How To Process Healthcare Data in Hadoop, Pig (IBM Demo Cloud)

    Here is Basic Commends Showing How To Process Healthcare Data in Hadoop, Pig Using IBM Demo Cloud. Unlike server log, healthcare data lacks universal format.

  • Install Apache Hadoop on Ubuntu on Single Cloud Server Instance

    Here is How Install Apache Hadoop on Ubuntu on Single Cloud Server Instance in Stand-Alone Mode With Minimum System Requirement and Commands.

  • Join/Merge Multiple Log Files For Big Data Analysis

    Here Are The Ways To Join/Merge Multiple Log Files For Big Data Analysis, Store Them To OpenStack Based Cloud Storage And Delete Old Files.

  • Advantages & Disadvantages of Using IBM Big Data Analytics On Cloud

    This article namely Advantages & Disadvantages of Using IBM Big Data Analytics On Cloud is like a case study which deals with the big data analytics tools from one of the largest IT corporations in the world – IBM.

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

Get new posts by email:

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 (24.3K Followers)
  • Twitter (5.8k 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

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

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

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