Here is sort based on example 5 of Sort from http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Sort
index=java sourcetype=j2ee source="/opt/jbosslogs/profileData.log" web{ profile=$app_tok$ | eval environment=case(like(host, "%t"), "Test", like(host, "%s"), "Stage", like(host, "%n"), "Train", like(host, "%p"), "Production") | table _time, environment, host, proxy_name, path, pattern | eval sort_environment=case(environment=="Train",1, environment=="Test",2, environment=="Stage",3, environment=="Production",4) | sort -sort_environment, _time | fields - sort_environment
... View more